all repos — st @ 02d2df5790d186f16e0e22becd8107a85f328c2f

st (suckless terminal) config

Do not eat ESC character if control string is not properly terminated.

Currently tputc handles the case of too long control string waiting for
the end of control string.

Another case is when there is ESC character is encountered but is not
followed by '\\'.  In this case st stops processing control string,
but ESC character is ignored.

After this patch st processes ESC characters in control strings properly.

Test case:
printf '\e]0;abc\e[1mBOLD\e[0m'

Also ^[\ is actually processed in the code that handles ST.
According to ECMA-048 ST stands for STRING TERMINATOR and is used to
close control strings.
noname noname@inventati.org
commit

02d2df5790d186f16e0e22becd8107a85f328c2f

parent

c4b79b055df9ef0126f05dd6dbd2bbf935dcb980

1 files changed, 3 insertions(+), 5 deletions(-)

jump to
M st.cst.c

@@ -2452,10 +2452,6 @@ term.esc = 0;

csiparse(); csihandle(); } - } else if(term.esc & ESC_STR_END) { - term.esc = 0; - if(ascii == '\\') - strhandle(); } else if(term.esc & ESC_ALTCHARSET) { tdeftran(ascii); tselcs();

@@ -2545,7 +2541,9 @@ case '8': /* DECRC -- Restore Cursor */

tcursor(CURSOR_LOAD); term.esc = 0; break; - case '\\': /* ST -- Stop */ + case '\\': /* ST -- String Terminator */ + if(term.esc & ESC_STR_END) + strhandle(); term.esc = 0; break; default: