neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 34d41baf8a8e4ab8c006b7f29a8106e60e311aa2
parent 55e81b0fe8bb205b579c1da24b3ac042191a4bbf
Author: Wsevolod <kefirchik3@gmail.com>
Date:   Thu,  7 Jul 2022 12:09:11 +0300

feat(tui): try terminfo for [re]set_cursor_color OSC #19255


Diffstat:
Msrc/nvim/tui/tui.c | 33+++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c @@ -2037,22 +2037,27 @@ static void augment_terminfo(TUIData *data, const char *term, long vte_version, } } - if (iterm || iterm_pretending_xterm) { - // FIXME: Bypassing tmux like this affects the cursor colour globally, in - // all panes, which is not particularly desirable. A better approach - // would use a tmux control sequence and an extra if(screen) test. - data->unibi_ext.set_cursor_color = - (int)unibi_add_ext_str(ut, NULL, TMUX_WRAP(tmux, "\033]Pl%p1%06x\033\\")); - } else if ((xterm || rxvt || tmux || alacritty) - && (vte_version == 0 || vte_version >= 3900)) { - // Supported in urxvt, newer VTE. - data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(ut, "ext.set_cursor_color", - "\033]12;#%p1%06x\007"); + data->unibi_ext.set_cursor_color = unibi_find_ext_str(ut, "Cs"); + if (-1 == data->unibi_ext.set_cursor_color) { + if (iterm || iterm_pretending_xterm) { + // FIXME: Bypassing tmux like this affects the cursor colour globally, in + // all panes, which is not particularly desirable. A better approach + // would use a tmux control sequence and an extra if(screen) test. + data->unibi_ext.set_cursor_color = + (int)unibi_add_ext_str(ut, NULL, TMUX_WRAP(tmux, "\033]Pl%p1%06x\033\\")); + } else if ((xterm || rxvt || tmux || alacritty) + && (vte_version == 0 || vte_version >= 3900)) { + // Supported in urxvt, newer VTE. + data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(ut, "ext.set_cursor_color", + "\033]12;#%p1%06x\007"); + } } - if (-1 != data->unibi_ext.set_cursor_color) { - data->unibi_ext.reset_cursor_color = (int)unibi_add_ext_str(ut, "ext.reset_cursor_color", - "\x1b]112\x07"); + data->unibi_ext.reset_cursor_color = unibi_find_ext_str(ut, "Cr"); + if (-1 == data->unibi_ext.reset_cursor_color) { + data->unibi_ext.reset_cursor_color = (int)unibi_add_ext_str(ut, "ext.reset_cursor_color", + "\x1b]112\x07"); + } } data->unibi_ext.save_title = (int)unibi_add_ext_str(ut, "ext.save_title", "\x1b[22;0t");