aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-01-25 11:15:05 -0500
committerJames McCoy <jamessan@jamessan.com>2017-01-25 11:15:05 -0500
commitfd2d4c5ab93a2602cc19d0f48062ff37087dae30 (patch)
treefcf2c8f0492eb70e817ea71b78cbf8fb724f6478 /src
parent25427ae892ccbb537a718c8abfbd4c79d9f94091 (diff)
downloadrneovim-fd2d4c5ab93a2602cc19d0f48062ff37087dae30.tar.gz
rneovim-fd2d4c5ab93a2602cc19d0f48062ff37087dae30.tar.bz2
rneovim-fd2d4c5ab93a2602cc19d0f48062ff37087dae30.zip
tui: Ignore DECRST 12 in terminfo's cursor_normal, if present
As discussed in neovim/neovim#5977, it's typical for the terminfo database to disable cursor blink as part of setting up the normal cursor. Since this interferes with the user's control over the cursor, we'll skip over DECRST 12 if it starts the cursor_normal entry. Note, this doesn't handle any case where DECRST 12 is not at the start of the entry since unibilium simply stores the given pointer. We would need to allocate (and somewhere free) a modified copy of what we get back from unibi_get_str to handle that.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/tui/tui.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 342c68818d..ed82e23be2 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -844,7 +844,16 @@ static void fix_terminfo(TUIData *data)
}
if (STARTS_WITH(term, "xterm") || STARTS_WITH(term, "rxvt")) {
- unibi_set_if_empty(ut, unibi_cursor_normal, "\x1b[?25h");
+ const char *normal = unibi_get_str(ut, unibi_cursor_normal);
+ if (!normal) {
+ unibi_set_str(ut, unibi_cursor_normal, "\x1b[?25h");
+ } else if (STARTS_WITH(normal, "\x1b[?12l")) {
+ // terminfo typically includes DECRST 12 as part of setting up the normal
+ // cursor, which interferes with the user's control via
+ // NVIM_TUI_ENABLE_CURSOR_SHAPE. When DECRST 12 is present, skip over
+ // it, but honor the rest of the TI setting.
+ unibi_set_str(ut, unibi_cursor_normal, normal + strlen("\x1b[?12l"));
+ }
unibi_set_if_empty(ut, unibi_cursor_invisible, "\x1b[?25l");
unibi_set_if_empty(ut, unibi_flash_screen, "\x1b[?5h$<100/>\x1b[?5l");
unibi_set_if_empty(ut, unibi_exit_attribute_mode, "\x1b(B\x1b[m");