fix(tui): more compatible way to reset cursor #40234

Problem:
All (tested by me) terminals (xterm, st, ghostty, vte, foot, wezterm, konsole) do support `\x1b[0 q` as "reset cursor to default", but at least konsole and wezterm only understands `\x1b[0 q` as "reset to default", but have different behaviour on `\x1b[ q` (konsole sets "steady block", and wezterm does nothing (do not change cursor shape).

Solution:
Use `\x1b[0 q` would be more widely compatible "reset" sequence than `\x1b[ q`

P.S. actually, `xterm`, `ghostty` and `st` (with default config.h) sets "steady block" for both sequence, but still here `[0` behaves the same as `[`
This commit is contained in:
Vadim Misbakh-Soloviov
2026-06-14 22:43:44 +07:00
committed by GitHub
parent 966e7a98f5
commit 224ad8a538

View File

@@ -2378,7 +2378,7 @@ static void patch_terminfo_bugs(TUIData *tui, const char *term, const char *colo
|| (linuxvt
&& (xterm_version || (vte_version > 0) || colorterm)))) {
terminfo_set_str(tui, kTerm_set_cursor_style, "\x1b[%p1%d q");
terminfo_set_str(tui, kTerm_reset_cursor_style, "\x1b[ q");
terminfo_set_str(tui, kTerm_reset_cursor_style, "\x1b[0 q");
} else if (linuxvt) {
// Linux uses an idiosyncratic escape code to set the cursor shape and
// does not support DECSCUSR.