Hello - I am the author of a TUI library and received a bug report regarding cursor placement on exiting an application.
I was able to narrow down a simple reproducer to how st a XTSMGRAPHICS query: echo -e "\x1b[?2;1;0S" This can also be seen when using a notcurses application which *doesn't* enter the altscreen (ie `ncls`). notcurses does the XTSMGRAPHICS query in the alt screen (which is also the solution I will be using), but `ncls` uses notcurses direct mode, which never enters the alt screen thus this bug appears there as well. I checked the source and it looks like the parser is not checking for a private indicator when handling a CSI with final character S. In that case, this query gets parsed as a SU sequence. I think that ought be modified to ensure there isn't a '?' private indicator in the sequence before handling as SU. Not much of a C programmer but I could take a shot at this if the solution sounds ok. -- Tim