[hackers] [st][PATCH] Eat up "CSI 58" sequences

From: sasha <sasha.code_AT_posteo.mx>
Date: Sun, 27 Jul 2025 05:43:47 +0000

This is used in the wild by systemd systemctl for example and st
misinterpreted it as "blink", because it didn't know "58", then saw "5"
as "blink", and then didn't know "245".

This should print "foo" as normal text:

    printf '\e[58:5:245mfoo\n'
    printf '\e[58:2:50:100:200mfoo\n'
---
 st.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/st.c b/st.c
index 03b9bc8..37f38c5 100644
--- a/st.c
+++ b/st.c
_AT_@ -1430,6 +1430,12 @@ tsetattr(const int *attr, int l)
 		case 49:
 			term.c.attr.bg = defaultbg;
 			break;
+		case 58:
+			/* This starts a sequence to change the color of
+			 * "underline" pixels. We don't support that and
+			 * instead eat up a following "5;n" or "2;r;g;b". */
+			tdefcolor(attr, &i, l);
+			break;
 		default:
 			if (BETWEEN(attr[i], 30, 37)) {
 				term.c.attr.fg = attr[i] - 30;
-- 
2.50.1
Received on Sun Jul 27 2025 - 07:43:47 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 27 2025 - 07:48:35 CEST