aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeerthan Jaic <jckeerthan@gmail.com>2015-08-03 13:53:35 -0400
committerJustin M. Keyes <justinkz@gmail.com>2015-08-04 12:33:43 -0400
commit5fc4c2d442f01ab53fa95c7732c834950d283190 (patch)
treeeaf03e9182d336c5a20920f0706aaa1e4243a46b
parent95a4dc6487bba4b742cad3f0b3cbd9af2534ad4b (diff)
downloadrneovim-5fc4c2d442f01ab53fa95c7732c834950d283190.tar.gz
rneovim-5fc4c2d442f01ab53fa95c7732c834950d283190.tar.bz2
rneovim-5fc4c2d442f01ab53fa95c7732c834950d283190.zip
tui: Fix terminal detection for cursor shape #3129
Default to DECSCUSR, except for known cases where other codes are used or changing cursor shape is unsupported
-rw-r--r--src/nvim/tui/tui.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 2659125d2d..56bdc73bc5 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -809,18 +809,21 @@ static void fix_terminfo(TUIData *data)
#define TMUX_WRAP(seq) (inside_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq)
// Support changing cursor shape on some popular terminals.
const char *term_prog = os_getenv("TERM_PROGRAM");
+ const char *vte_version = os_getenv("VTE_VERSION");
- if ((term_prog && !strcmp(term_prog, "iTerm.app"))
- || os_getenv("ITERM_SESSION_ID") != NULL) {
- // iterm
+ if ((term_prog && !strcmp(term_prog, "Konsole"))
+ || os_getenv("KONSOLE_DBUS_SESSION") != NULL) {
+ // Konsole uses a proprietary escape code to set the cursor shape
+ // and does not suppport DECSCUSR.
data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b]50;CursorShape=1;BlinkingCursorEnabled=1\x07"));
data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b]50;CursorShape=2;BlinkingCursorEnabled=1\x07"));
data->unibi_ext.exit_insert_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b]50;CursorShape=0;BlinkingCursorEnabled=0\x07"));
- } else {
- // xterm-like sequences for blinking bar and solid block
+ } else if (!vte_version || atoi(vte_version) >= 3900) {
+ // Assume that the terminal supports DECSCUSR unless it is an
+ // old VTE based terminal
data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b[5 q"));
data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL,