forked from aniani/vim
patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Problem: Screen not recognized as supporting "sgr" mouse codes. Solution: Recognize screen 4.7. (Jordan Christiansen, closes #5042)
This commit is contained in:
16
src/term.c
16
src/term.c
@@ -4649,8 +4649,8 @@ not_enough:
|
|||||||
if (tp[0] == CSI)
|
if (tp[0] == CSI)
|
||||||
switch_to_8bit();
|
switch_to_8bit();
|
||||||
|
|
||||||
// rxvt sends its version number: "20703" is 2.7.3.
|
|
||||||
// Screen sends 40500.
|
// Screen sends 40500.
|
||||||
|
// rxvt sends its version number: "20703" is 2.7.3.
|
||||||
// Ignore it for when the user has set 'term' to xterm,
|
// Ignore it for when the user has set 'term' to xterm,
|
||||||
// even though it's an rxvt.
|
// even though it's an rxvt.
|
||||||
if (version > 20000)
|
if (version > 20000)
|
||||||
@@ -4661,6 +4661,7 @@ not_enough:
|
|||||||
int need_flush = FALSE;
|
int need_flush = FALSE;
|
||||||
int is_iterm2 = FALSE;
|
int is_iterm2 = FALSE;
|
||||||
int is_mintty = FALSE;
|
int is_mintty = FALSE;
|
||||||
|
int is_screen = FALSE;
|
||||||
|
|
||||||
// mintty 2.9.5 sends 77;20905;0c.
|
// mintty 2.9.5 sends 77;20905;0c.
|
||||||
// (77 is ASCII 'M' for mintty.)
|
// (77 is ASCII 'M' for mintty.)
|
||||||
@@ -4706,14 +4707,21 @@ not_enough:
|
|||||||
is_not_xterm = TRUE;
|
is_not_xterm = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// screen sends 83;40500;0 83 is 'S' in ASCII.
|
||||||
|
if (arg[0] == 83)
|
||||||
|
is_screen = TRUE;
|
||||||
|
|
||||||
// Only set 'ttymouse' automatically if it was not set
|
// Only set 'ttymouse' automatically if it was not set
|
||||||
// by the user already.
|
// by the user already.
|
||||||
if (!option_was_set((char_u *)"ttym"))
|
if (!option_was_set((char_u *)"ttym"))
|
||||||
{
|
{
|
||||||
// Xterm version 277 supports SGR. Also support
|
// Xterm version 277 supports SGR. Also support
|
||||||
// Terminal.app, iTerm2 and mintty.
|
// Terminal.app, iTerm2, mintty, and screen 4.7+.
|
||||||
if (version >= 277 || is_iterm2 || is_mac_terminal
|
if ((!is_screen && version >= 277)
|
||||||
|| is_mintty)
|
|| is_iterm2
|
||||||
|
|| is_mac_terminal
|
||||||
|
|| is_mintty
|
||||||
|
|| (is_screen && arg[1] >= 40700))
|
||||||
set_option_value((char_u *)"ttym", 0L,
|
set_option_value((char_u *)"ttym", 0L,
|
||||||
(char_u *)"sgr", 0);
|
(char_u *)"sgr", 0);
|
||||||
// if xterm version >= 95 use mouse dragging
|
// if xterm version >= 95 use mouse dragging
|
||||||
|
@@ -882,10 +882,35 @@ func Test_xx01_term_style_response()
|
|||||||
set t_RV=
|
set t_RV=
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" This checks the iTerm2 version response.
|
||||||
|
" This must be after other tests, because it has side effects to xterm
|
||||||
|
" properties.
|
||||||
|
func Test_xx02_iTerm2_response()
|
||||||
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
|
set t_RV=x
|
||||||
|
|
||||||
|
" Old versions of iTerm2 used a different style term response.
|
||||||
|
set ttymouse=xterm
|
||||||
|
call test_option_not_set('ttymouse')
|
||||||
|
let seq = "\<Esc>[>0;95;c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
call assert_equal('xterm', &ttymouse)
|
||||||
|
|
||||||
|
set ttymouse=xterm
|
||||||
|
call test_option_not_set('ttymouse')
|
||||||
|
let seq = "\<Esc>[>0;95;0c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
call assert_equal('sgr', &ttymouse)
|
||||||
|
|
||||||
|
set t_RV=
|
||||||
|
endfunc
|
||||||
|
|
||||||
" This checks the libvterm version response.
|
" This checks the libvterm version response.
|
||||||
" This must be after other tests, because it has side effects to xterm
|
" This must be after other tests, because it has side effects to xterm
|
||||||
" properties.
|
" properties.
|
||||||
func Test_xx02_libvterm_response()
|
func Test_xx03_libvterm_response()
|
||||||
" Termresponse is only parsed when t_RV is not empty.
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
set t_RV=x
|
set t_RV=x
|
||||||
|
|
||||||
@@ -899,10 +924,73 @@ func Test_xx02_libvterm_response()
|
|||||||
set t_RV=
|
set t_RV=
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" This checks the Mac Terminal.app version response.
|
||||||
|
" This must be after other tests, because it has side effects to xterm
|
||||||
|
" properties.
|
||||||
|
func Test_xx04_Mac_Terminal_response()
|
||||||
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
|
set t_RV=x
|
||||||
|
|
||||||
|
set ttymouse=xterm
|
||||||
|
call test_option_not_set('ttymouse')
|
||||||
|
let seq = "\<Esc>[>1;95;0c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
call assert_equal('sgr', &ttymouse)
|
||||||
|
|
||||||
|
" Reset is_not_xterm and is_mac_terminal.
|
||||||
|
set t_RV=
|
||||||
|
set term=xterm
|
||||||
|
set t_RV=x
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" This checks the mintty version response.
|
||||||
|
" This must be after other tests, because it has side effects to xterm
|
||||||
|
" properties.
|
||||||
|
func Test_xx05_mintty_response()
|
||||||
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
|
set t_RV=x
|
||||||
|
|
||||||
|
set ttymouse=xterm
|
||||||
|
call test_option_not_set('ttymouse')
|
||||||
|
let seq = "\<Esc>[>77;20905;0c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
call assert_equal('sgr', &ttymouse)
|
||||||
|
|
||||||
|
set t_RV=
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" This checks the screen version response.
|
||||||
|
" This must be after other tests, because it has side effects to xterm
|
||||||
|
" properties.
|
||||||
|
func Test_xx06_screen_response()
|
||||||
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
|
set t_RV=x
|
||||||
|
|
||||||
|
" Old versions of screen don't support SGR mouse mode.
|
||||||
|
set ttymouse=xterm
|
||||||
|
call test_option_not_set('ttymouse')
|
||||||
|
let seq = "\<Esc>[>83;40500;0c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
call assert_equal('xterm', &ttymouse)
|
||||||
|
|
||||||
|
" screen supports SGR mouse mode starting in version 4.7.
|
||||||
|
set ttymouse=xterm
|
||||||
|
call test_option_not_set('ttymouse')
|
||||||
|
let seq = "\<Esc>[>83;40700;0c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
call assert_equal('sgr', &ttymouse)
|
||||||
|
|
||||||
|
set t_RV=
|
||||||
|
endfunc
|
||||||
|
|
||||||
" This checks the xterm version response.
|
" This checks the xterm version response.
|
||||||
" This must be after other tests, because it has side effects to xterm
|
" This must be after other tests, because it has side effects to xterm
|
||||||
" properties.
|
" properties.
|
||||||
func Test_xx03_xterm_response()
|
func Test_xx07_xterm_response()
|
||||||
" Termresponse is only parsed when t_RV is not empty.
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
set t_RV=x
|
set t_RV=x
|
||||||
|
|
||||||
@@ -944,8 +1032,6 @@ func Test_xx03_xterm_response()
|
|||||||
set t_RV=
|
set t_RV=
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" TODO: check other terminals response
|
|
||||||
|
|
||||||
func Test_get_termcode()
|
func Test_get_termcode()
|
||||||
try
|
try
|
||||||
let k1 = &t_k1
|
let k1 = &t_k1
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2174,
|
||||||
/**/
|
/**/
|
||||||
2173,
|
2173,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user