fix(tui): cursor color in suckless terminal #32310

Problem:
's 'guicursor' cursor color not working in suckless terminal (ST).
Nvim's builtin terminfo for ST lacks a "Cs" entry, even though ST does
support the cursor color to be set via termcodes.

Solution:
- In `augment_terminfo()`, assume that `st` always supports color cursor.
- Thomas Dickey will add a "Cs" entry for st to ncurses, from which
  Nvim's builtin terminfos are generated.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This commit is contained in:
uio23 2025-02-03 22:09:47 +13:00 committed by GitHub
parent 445ecca398
commit 720ec5cec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2294,6 +2294,7 @@ static void augment_terminfo(TUIData *tui, const char *term, int vte_version, in
bool putty = terminfo_is_term_family(term, "putty");
bool screen = terminfo_is_term_family(term, "screen");
bool tmux = terminfo_is_term_family(term, "tmux") || !!os_getenv("TMUX");
bool st = terminfo_is_term_family(term, "st");
bool iterm = terminfo_is_term_family(term, "iterm")
|| terminfo_is_term_family(term, "iterm2")
|| terminfo_is_term_family(term, "iTerm.app")
@ -2378,9 +2379,10 @@ static void augment_terminfo(TUIData *tui, const char *term, int vte_version, in
// would use a tmux control sequence and an extra if(screen) test.
tui->unibi_ext.set_cursor_color =
(int)unibi_add_ext_str(ut, NULL, TMUX_WRAP(tmux, "\033]Pl%p1%06x\033\\"));
} else if ((xterm || hterm || rxvt || tmux || alacritty)
} else if ((xterm || hterm || rxvt || tmux || alacritty || st)
&& (vte_version == 0 || vte_version >= 3900)) {
// Supported in urxvt, newer VTE.
// Supported in st, but currently missing in ncurses definitions. #32217
tui->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(ut, "ext.set_cursor_color",
"\033]12;%p1%s\007");
}