Eat up "CSI 58" sequences

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💯200mfoo\n'

Ref.
https://git.suckless.org/st/commit/f114bcedd113017d907aad32031db92c050f4bf3.html
This commit is contained in:
Bakkeby 2025-07-27 20:46:31 +02:00
parent fba8d10417
commit 92e6c003f7
2 changed files with 8 additions and 1 deletions

7
st.c
View file

@ -1864,6 +1864,13 @@ tsetattr(const int *attr, int l)
term.c.attr.ucolor[2] = -1;
term.c.attr.mode ^= ATTR_DIRTYUNDERLINE;
break;
#else
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;
#endif // UNDERCURL_PATCH
default:
if (BETWEEN(attr[i], 30, 37)) {