diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2025-01-26 13:40:57 +0100 |
|---|---|---|
| committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2025-01-30 17:50:37 +0100 |
| commit | 98610fcd37f655d44586323dc86c1d013c2798ce (patch) | |
| tree | 23be46d7d1350efe6404ff8ba506b68aeb6d2ad2 | |
| parent | Clear screen: Fix edge case (diff) | |
| download | st-98610fcd37f655d44586323dc86c1d013c2798ce.tar.gz st-98610fcd37f655d44586323dc86c1d013c2798ce.zip | |
Do not interpret CSI ? u as DECRC
The kitty keyboard protocol docs recommend CSI ? u to query support for
that protocol, see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
For better or worse, fish shell uses this query to work around bugs
in other terminals triggered by requesting that protocol via CSI = 5 u.
Unfortunately, st interprets CSI ? u as DECRC (restore cursor
position). reproduce with 'printf "\x1b[?u"; cat'.
fish could work around this by switching to the alternate screen
before running this query; but that might cause tearing on terminals
that don't support Synchronized Output. I'm not sure.
In the meantime, let's correct our parser.
This adds a redundant else-after-return, for consistency with the
surrounding code.
| -rw-r--r-- | st.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -1801,7 +1801,11 @@ csihandle(void) | |||
| 1801 | tcursor(CURSOR_SAVE); | 1801 | tcursor(CURSOR_SAVE); |
| 1802 | break; | 1802 | break; |
| 1803 | case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ | 1803 | case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ |
| 1804 | tcursor(CURSOR_LOAD); | 1804 | if (csiescseq.priv) { |
| 1805 | goto unknown; | ||
| 1806 | } else { | ||
| 1807 | tcursor(CURSOR_LOAD); | ||
| 1808 | } | ||
| 1805 | break; | 1809 | break; |
| 1806 | case ' ': | 1810 | case ' ': |
| 1807 | switch (csiescseq.mode[1]) { | 1811 | switch (csiescseq.mode[1]) { |
