Merge pull request #3165 from blueyed/dont-wrap-DECSCUSR-for-tmux

[RFC] Do not use TMUX_WRAP for DECSCUSR sequence

Reviewed-by: Felipe Morales
Reviewed-by: Justin M. Keyes
Reviewed-by: Michael Reed
This commit is contained in:
Michael Reed 2016-01-29 19:22:27 -05:00
commit 5ffe1425c9
2 changed files with 25 additions and 7 deletions

View File

@ -1,4 +1,4 @@
.Dd November 11, 2015 .Dd January 28, 2016
.Dt NVIM 1 .Dt NVIM 1
.Os .Os
.Sh NAME .Sh NAME
@ -373,8 +373,24 @@ Used to set the 'shell' option, which determines the shell used by the
command. command.
.It Ev NVIM_TUI_ENABLE_CURSOR_SHAPE .It Ev NVIM_TUI_ENABLE_CURSOR_SHAPE
If defined, change the cursor shape to a vertical bar while in insert mode. If defined, change the cursor shape to a vertical bar while in insert mode.
Requires that the host terminal support the DECSCUSR CSI escape sequence. Requires that the host terminal supports the DECSCUSR CSI escape sequence.
Has no effect in GUIs. Has no effect in GUIs.
.Pp
Depending on the terminal emulator, using this option with
.Nm
under
.Xr tmux 1
might require adding the following to
.Pa ~/.tmux.conf :
.Bd -literal -offset indent
set -ga terminal-overrides ',*:Ss=\eE[%p1%d q:Se=\eE[2 q'
.Ed
.Pp
See
.Ic terminal-overrides
in the
.Xr tmux 1
manual page for more information.
.It Ev NVIM_TUI_ENABLE_TRUE_COLOR .It Ev NVIM_TUI_ENABLE_TRUE_COLOR
If defined, assume the host terminal supports 24 bit colors. If defined, assume the host terminal supports 24 bit colors.
Has no effect in GUIs. Has no effect in GUIs.

View File

@ -845,7 +845,7 @@ static void fix_terminfo(TUIData *data)
if ((term_prog && !strcmp(term_prog, "Konsole")) if ((term_prog && !strcmp(term_prog, "Konsole"))
|| os_getenv("KONSOLE_DBUS_SESSION") != NULL) { || os_getenv("KONSOLE_DBUS_SESSION") != NULL) {
// Konsole uses a proprietary escape code to set the cursor shape // Konsole uses a proprietary escape code to set the cursor shape
// and does not suppport DECSCUSR. // and does not support DECSCUSR.
data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL, data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b]50;CursorShape=1;BlinkingCursorEnabled=1\x07")); TMUX_WRAP("\x1b]50;CursorShape=1;BlinkingCursorEnabled=1\x07"));
data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL, data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL,
@ -854,13 +854,15 @@ static void fix_terminfo(TUIData *data)
TMUX_WRAP("\x1b]50;CursorShape=0;BlinkingCursorEnabled=0\x07")); TMUX_WRAP("\x1b]50;CursorShape=0;BlinkingCursorEnabled=0\x07"));
} else if (!vte_version || atoi(vte_version) >= 3900) { } else if (!vte_version || atoi(vte_version) >= 3900) {
// Assume that the terminal supports DECSCUSR unless it is an // Assume that the terminal supports DECSCUSR unless it is an
// old VTE based terminal // old VTE based terminal. This should not get wrapped for tmux,
// which will handle it via its Ss/Se terminfo extension - usually
// according to its terminal-overrides.
data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL, data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b[5 q")); "\x1b[5 q");
data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL, data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b[3 q")); "\x1b[3 q");
data->unibi_ext.exit_insert_mode = (int)unibi_add_ext_str(ut, NULL, data->unibi_ext.exit_insert_mode = (int)unibi_add_ext_str(ut, NULL,
TMUX_WRAP("\x1b[2 q")); "\x1b[2 q");
} }
end: end: