1
0
forked from aniani/vim

patch 9.0.0954: cannot detect whether modifyOtherKeys is enabled

Problem:    Cannot detect whether modifyOtherKeys is enabled.
Solution:   Use XTQMODKEYS introduced by xterm version 377 to request the
            modifyOtherKeys level.  Update the keycode check results.
This commit is contained in:
Bram Moolenaar
2022-11-26 19:16:48 +00:00
parent 837ca8f43b
commit c255b78965
13 changed files with 201 additions and 33 deletions

View File

@@ -2463,7 +2463,11 @@ check_simplify_modifier(int max_offset)
static int static int
key_protocol_enabled(void) key_protocol_enabled(void)
{ {
return seenModifyOtherKeys || kitty_protocol_state == KKPS_ENABLED; // If xterm has responded to XTQMODKEYS it overrules seenModifyOtherKeys.
int using_mok = modify_otherkeys_state != MOKS_INITIAL
? modify_otherkeys_state == MOKS_ENABLED
: seenModifyOtherKeys;
return using_mok || kitty_protocol_state == KKPS_ENABLED;
} }
/* /*

View File

@@ -1374,9 +1374,29 @@ EXTERN int reg_executing INIT(= 0); // register being executed or zero
EXTERN int pending_end_reg_executing INIT(= 0); EXTERN int pending_end_reg_executing INIT(= 0);
// Set when a modifyOtherKeys sequence was seen, then simplified mappings will // Set when a modifyOtherKeys sequence was seen, then simplified mappings will
// no longer be used. // no longer be used. To be combined with modify_otherkeys_state.
EXTERN int seenModifyOtherKeys INIT(= FALSE); EXTERN int seenModifyOtherKeys INIT(= FALSE);
// The state for the modifyOtherKeys level
typedef enum {
// Initially we have no clue if the protocol is on or off.
MOKS_INITIAL,
// Used when receiving the state and the level is not two.
MOKS_OFF,
// Used when receiving the state and the level is two.
MOKS_ENABLED,
// Used after outputting t_KE when the state was MOKS_ENABLED. We do not
// really know if t_KE actually disabled the protocol, the following t_KI
// is expected to request the state, but the response may come only later.
MOKS_DISABLED,
// Used after outputting t_KE when the state was not MOKS_ENABLED.
MOKS_AFTER_T_KE,
} mokstate_T;
// Set when a response to XTQMODKEYS was received. Only works for xterm
// version 377 and later.
EXTERN mokstate_T modify_otherkeys_state INIT(= MOKS_INITIAL);
// The state for the Kitty keyboard protocol. // The state for the Kitty keyboard protocol.
typedef enum { typedef enum {
// Initially we have no clue if the protocol is on or off. // Initially we have no clue if the protocol is on or off.

View File

@@ -315,7 +315,26 @@ list_mappings(
if (p_verbose > 0 && keyround == 1) if (p_verbose > 0 && keyround == 1)
{ {
if (seenModifyOtherKeys) if (seenModifyOtherKeys)
msg_puts(_("Seen modifyOtherKeys: true")); msg_puts(_("Seen modifyOtherKeys: true\n"));
if (modify_otherkeys_state != MOKS_INITIAL)
{
char *name = _("Unknown");
switch (modify_otherkeys_state)
{
case MOKS_INITIAL: break;
case MOKS_OFF: name = _("Off"); break;
case MOKS_ENABLED: name = _("On"); break;
case MOKS_DISABLED: name = _("Disabled"); break;
case MOKS_AFTER_T_KE: name = _("Cleared"); break;
}
char buf[200];
vim_snprintf(buf, sizeof(buf),
_("modifyOtherKeys detected: %s\n"), name);
msg_puts(buf);
}
if (kitty_protocol_state != KKPS_INITIAL) if (kitty_protocol_state != KKPS_INITIAL)
{ {
char *name = _("Unknown"); char *name = _("Unknown");
@@ -329,7 +348,8 @@ list_mappings(
} }
char buf[200]; char buf[200];
vim_snprintf(buf, sizeof(buf), _("Kitty keyboard protocol: %s"), name); vim_snprintf(buf, sizeof(buf),
_("Kitty keyboard protocol: %s\n"), name);
msg_puts(buf); msg_puts(buf);
} }
} }

View File

@@ -450,7 +450,7 @@ static tcap_entry_T builtin_xterm[] = {
{(int)KS_TI, "\0337\033[?47h"}, {(int)KS_TI, "\0337\033[?47h"},
{(int)KS_TE, "\033[?47l\0338"}, {(int)KS_TE, "\033[?47l\0338"},
# endif # endif
{(int)KS_CTI, "\033[>4;2m"}, {(int)KS_CTI, "\033[>4;2m\033[?4m"}, // see "builtin_mok2"
{(int)KS_CTE, "\033[>4;m"}, {(int)KS_CTE, "\033[>4;m"},
{(int)KS_CIS, "\033]1;"}, {(int)KS_CIS, "\033]1;"},
{(int)KS_CIE, "\007"}, {(int)KS_CIE, "\007"},
@@ -591,7 +591,10 @@ static tcap_entry_T builtin_xterm[] = {
* xterm. * xterm.
*/ */
static tcap_entry_T builtin_mok2[] = { static tcap_entry_T builtin_mok2[] = {
{(int)KS_CTI, "\033[>4;2m"}, // XTQMODKEYS was added in xterm version 377: "CSI ? 4 m" which should
// return "{lead} > 4 ; Pv m". Before version 377 we expect it to have no
// effect.
{(int)KS_CTI, "\033[>4;2m\033[?4m"},
{(int)KS_CTE, "\033[>4;m"}, {(int)KS_CTE, "\033[>4;m"},
{(int)KS_NAME, NULL} // end marker {(int)KS_NAME, NULL} // end marker
@@ -3661,9 +3664,20 @@ out_str_t_TE(void)
out_str(T_CTE); out_str(T_CTE);
// The seenModifyOtherKeys flag is not reset here. We do expect t_TE to // The seenModifyOtherKeys flag is not reset here. We do expect t_TE to
// disable modifyOtherKeys, but there is no way to detect it's enabled // disable modifyOtherKeys, but until Xterm version 377 there is no way to
// again after the following t_TI. We assume that when seenModifyOtherKeys // detect it's enabled again after the following t_TI. We assume that when
// was set before it will still be valid. // seenModifyOtherKeys was set before it will still be valid.
// When the modifyOtherKeys level is detected to be 2 we expect t_TE to
// disable it. Remembering that it was detected to be enabled is useful in
// some situations.
// The following t_TI is expected to request the state and then
// modify_otherkeys_state will be set again.
if (modify_otherkeys_state == MOKS_ENABLED
|| modify_otherkeys_state == MOKS_DISABLED)
modify_otherkeys_state = MOKS_DISABLED;
else if (modify_otherkeys_state != MOKS_INITIAL)
modify_otherkeys_state = MOKS_AFTER_T_KE;
// When the kitty keyboard protocol is enabled we expect t_TE to disable // When the kitty keyboard protocol is enabled we expect t_TE to disable
// it. Remembering that it was detected to be enabled is useful in some // it. Remembering that it was detected to be enabled is useful in some
@@ -5112,6 +5126,8 @@ handle_key_without_modifier(
* Handle a CSI escape sequence. * Handle a CSI escape sequence.
* - Xterm version string. * - Xterm version string.
* *
* - Response to XTQMODKEYS: "{lead} > 4 ; Pv m".
*
* - Cursor position report: {lead}{row};{col}R * - Cursor position report: {lead}{row};{col}R
* The final byte must be 'R'. It is used for checking the * The final byte must be 'R'. It is used for checking the
* ambiguous-width character state. * ambiguous-width character state.
@@ -5121,6 +5137,7 @@ handle_key_without_modifier(
* - key with modifiers when modifyOtherKeys is enabled: * - key with modifiers when modifyOtherKeys is enabled:
* {lead}27;{modifier};{key}~ * {lead}27;{modifier};{key}~
* {lead}{key};{modifier}u * {lead}{key};{modifier}u
*
* Return 0 for no match, -1 for partial match, > 0 for full match. * Return 0 for no match, -1 for partial match, > 0 for full match.
*/ */
static int static int
@@ -5184,12 +5201,24 @@ handle_csi(
trail = *ap; trail = *ap;
csi_len = (int)(ap - tp) + 1; csi_len = (int)(ap - tp) + 1;
// Response to XTQMODKEYS: "CSI > 4 ; Pv m" where Pv indicates the
// modifyOtherKeys level. Drop similar responses.
if (first == '>' && (argc == 1 || argc == 2) && trail == 'm')
{
if (arg[0] == 4 && argc == 2)
modify_otherkeys_state = arg[1] == 2 ? MOKS_ENABLED : MOKS_OFF;
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
*slen = csi_len;
}
// Cursor position report: Eat it when there are 2 arguments // Cursor position report: Eat it when there are 2 arguments
// and it ends in 'R'. Also when u7_status is not "sent", it // and it ends in 'R'. Also when u7_status is not "sent", it
// may be from a previous Vim that just exited. But not for // may be from a previous Vim that just exited. But not for
// <S-F3>, it sends something similar, check for row and column // <S-F3>, it sends something similar, check for row and column
// to make sense. // to make sense.
if (first == -1 && argc == 2 && trail == 'R') else if (first == -1 && argc == 2 && trail == 'R')
{ {
handle_u7_response(arg, tp, csi_len); handle_u7_response(arg, tp, csi_len);
@@ -5822,6 +5851,8 @@ check_termcode(
* Also eat other possible responses to t_RV, rxvt returns * Also eat other possible responses to t_RV, rxvt returns
* "{lead}?1;2c". * "{lead}?1;2c".
* *
* - Response to XTQMODKEYS: "{lead} > 4 ; Pv m".
*
* - Cursor position report: {lead}{row};{col}R * - Cursor position report: {lead}{row};{col}R
* The final byte must be 'R'. It is used for checking the * The final byte must be 'R'. It is used for checking the
* ambiguous-width character state. * ambiguous-width character state.

View File

@@ -1 +1 @@
{"31kitty":{"Space":"20","version":"1b5b3e313b343030303b323163","C-Tab":"","A-Esc":"1b5b32373b313175","C-Space":"1b5b33323b3575","status":"1b5b3f3175","S-C-I":"1b5b3130353b3675","C-I":"1b5b3130353b3575","S-Tab":"1b5b393b3275","Tab":"09","resource":"","A-Tab":"1b5b393b313175","S-Space":"20","C-Esc":"1b5b32373b3575","protocol":"kitty","A-Space":"1b5b33323b313175","S-Esc":"1b5b32373b3275","Esc":"1b5b323775"},"32libvterm":{"Space":"20","version":"1b5b3e303b3130303b3063","C-Tab":"1b5b393b3575","A-Esc":"1b5b32373b3375","C-Space":"1b5b33323b3575","status":"1b5b3f3175","S-C-I":"1b5b3130353b3675","C-I":"1b5b3130353b3575","S-Tab":"1b5b393b3275","Tab":"09","resource":"","A-Tab":"1b5b393b3375","S-Space":"1b5b33323b3275","C-Esc":"1b5b32373b3575","protocol":"kitty","A-Space":"1b5b33323b3375","S-Esc":"1b5b323775","Esc":"1b5b323775"},"22libvterm":{"Space":"20","version":"1b5b3e303b3130303b3063","C-Tab":"1b5b32373b353b397e","A-Esc":"1b5b32373b333b32377e","C-Space":"1b5b32373b353b33327e","status":"","S-C-I":"1b5b32373b363b37337e","C-I":"1b5b32373b353b3130357e","S-Tab":"1b5b5a","Tab":"09","resource":"","A-Tab":"1b5b32373b333b397e","S-Space":"1b5b32373b323b33327e","C-Esc":"1b5b32373b353b32377e","protocol":"mok2","A-Space":"1b5b32373b333b33327e","S-Esc":"1b","Esc":"1b"},"13kitty":{"Space":"20","version":"1b5b3e313b343030303b323163","C-Tab":"","A-Esc":"1b1b","status":"","S-C-I":"1b5b3130353b3675","C-I":"09","S-Tab":"1b5b5a","Tab":"09","resource":"","A-Tab":"1b09","S-Space":"20","C-Esc":"1b","protocol":"none","A-Space":"1b5b33323b313175","S-Esc":"1b","Esc":"1b"},"21xterm":{"Space":"20","version":"1b5b3e34313b3335363b3063","C-Tab":"1b5b32373b353b397e","A-Esc":"1b5b32373b333b32377e","C-Space":"1b5b32373b353b33327e","status":"","S-C-I":"1b5b32373b363b37337e","C-I":"1b5b32373b353b3130357e","S-Tab":"1b5b5a","Tab":"09","resource":"=30","A-Tab":"1b5b32373b333b397e","S-Space":"1b5b32373b323b33327e","C-Esc":"1b5b32373b353b32377e","protocol":"mok2","A-Space":"1b5b32373b333b33327e","S-Esc":"1b","Esc":"1b"},"12libvterm":{"Space":"20","version":"1b5b3e303b3130303b3063","C-Tab":"1b5b393b3575","A-Esc":"9b00","status":"","S-C-I":"1b5b5a","C-I":"09","S-Tab":"1b5b5a","Tab":"09","S-Space":"1b5b33323b3275","A-Tab":"8900","resource":"","C-Esc":"1b5b32373b3575","protocol":"none","A-Space":"a000","S-Esc":"1b","Esc":"1b"},"11xterm":{"Space":"20","version":"1b5b3e34313b3335363b3063","C-Tab":"09","A-Esc":"9b00","status":"","S-C-I":"09","C-I":"09","S-Tab":"1b5b5a","Tab":"09","S-Space":"20","A-Tab":"8900","C-Esc":"1b","protocol":"none","A-Space":"a000","S-Esc":"1b","Esc":"1b"}} {"31kitty":{"Space":"20","version":"1b5b3e313b343030303b323163","C-Tab":"","A-Esc":"1b5b32373b313175","C-Space":"1b5b33323b3575","status":"1b5b3f3175","S-C-I":"1b5b3130353b3675","C-I":"1b5b3130353b3575","S-Tab":"1b5b393b3275","Tab":"09","resource":"","A-Tab":"1b5b393b313175","S-Space":"20","C-Esc":"1b5b32373b3575","protocol":"kitty","A-Space":"1b5b33323b313175","S-Esc":"1b5b32373b3275","Esc":"1b5b323775"},"32libvterm":{"Space":"20","version":"1b5b3e303b3130303b3063","C-Tab":"1b5b393b3575","A-Esc":"1b5b32373b3375","C-Space":"1b5b33323b3575","status":"1b5b3f3175","S-C-I":"1b5b3130353b3675","C-I":"1b5b3130353b3575","S-Tab":"1b5b393b3275","Tab":"09","resource":"","A-Tab":"1b5b393b3375","S-Space":"1b5b33323b3275","C-Esc":"1b5b32373b3575","protocol":"kitty","A-Space":"1b5b33323b3375","S-Esc":"1b5b323775","Esc":"1b5b323775"},"22libvterm":{"Space":"20","version":"1b5b3e303b3130303b3063","C-Tab":"1b5b32373b353b397e","A-Esc":"1b5b32373b333b32377e","C-Space":"1b5b32373b353b33327e","status":"","S-C-I":"1b5b32373b363b37337e","C-I":"1b5b32373b353b3130357e","S-Tab":"1b5b5a","Tab":"09","resource":"","A-Tab":"1b5b32373b333b397e","S-Space":"1b5b32373b323b33327e","C-Esc":"1b5b32373b353b32377e","protocol":"mok2","A-Space":"1b5b32373b333b33327e","S-Esc":"1b5b32373b323b32377e","Esc":"1b"},"13kitty":{"Space":"20","version":"1b5b3e313b343030303b323163","C-Tab":"","A-Esc":"1b1b","status":"","S-C-I":"1b5b3130353b3675","C-I":"09","S-Tab":"1b5b5a","Tab":"09","resource":"","A-Tab":"1b09","S-Space":"20","C-Esc":"1b","protocol":"none","A-Space":"1b5b33323b313175","S-Esc":"1b","Esc":"1b"},"21xterm":{"Space":"20","modkeys":"2","version":"1b5b3e34313b3337373b3063","C-Tab":"1b5b32373b353b397e","A-Esc":"1b5b32373b333b32377e","C-Space":"1b5b32373b353b33327e","status":"","S-C-I":"1b5b32373b363b37337e","C-I":"1b5b32373b353b3130357e","S-Tab":"1b5b5a","Tab":"09","resource":"=30","A-Tab":"1b5b32373b333b397e","S-Space":"1b5b32373b323b33327e","C-Esc":"1b5b32373b353b32377e","protocol":"mok2","A-Space":"1b5b32373b333b33327e","S-Esc":"1b5b32373b323b32377e","Esc":"1b"},"12libvterm":{"Space":"20","version":"1b5b3e303b3130303b3063","C-Tab":"1b5b393b3575","A-Esc":"9b00","status":"","S-C-I":"1b5b5a","C-I":"09","S-Tab":"1b5b5a","Tab":"09","S-Space":"1b5b33323b3275","A-Tab":"8900","resource":"","C-Esc":"1b5b32373b3575","protocol":"none","A-Space":"a000","S-Esc":"1b","Esc":"1b"},"11xterm":{"Space":"20","version":"1b5b3e34313b3337373b3063","C-Tab":"09","A-Esc":"9b00","status":"","S-C-I":"09","C-I":"09","S-Tab":"1b5b5a","Tab":"09","resource":"","A-Tab":"8900","S-Space":"20","C-Esc":"1b","protocol":"none","A-Space":"a000","S-Esc":"1b","Esc":"1b"}}

View File

@@ -134,7 +134,7 @@ def ActionList()
endif endif
sort(terms) sort(terms)
var items = ['protocol', 'version', 'status', 'resource'] var items = ['protocol', 'version', 'status', 'modkeys']
+ key_entries->copy()->map((_, v) => v[1]) + key_entries->copy()->map((_, v) => v[1])
# For each terminal compute the needed width, add two. # For each terminal compute the needed width, add two.
@@ -198,9 +198,8 @@ def DoTerm(name: string)
if proto == 1 if proto == 1
&t_TI = "" &t_TI = ""
elseif proto == 2 elseif proto == 2
# Enable modifyOtherKeys level 2 # Enable modifyOtherKeys level 2. Request the XTQMODKEYS value.
# Request the resource value: DCS + Q modifyOtherKeys ST &t_TI = "\<Esc>[>4;2m" .. "\<Esc>[?4m"
&t_TI = "\<Esc>[>4;2m" .. "\<Esc>P+Q6d6f646966794f746865724b657973\<Esc>\\"
proto_name = 'mok2' proto_name = 'mok2'
elseif proto == 3 elseif proto == 3
# Enable Kitty keyboard protocol and request the status # Enable Kitty keyboard protocol and request the status
@@ -218,10 +217,10 @@ def DoTerm(name: string)
# Pattern that matches the line with the version response. # Pattern that matches the line with the version response.
const version_pattern = "\<Esc>\\[>\\d\\+;\\d\\+;\\d*c" const version_pattern = "\<Esc>\\[>\\d\\+;\\d\\+;\\d*c"
# Pattern that matches the resource value response: # Pattern that matches the XTQMODKEYS response:
# DCS 1 + R Pt ST valid # CSI > 4;Pv m
# DCS 0 + R Pt ST invalid # where Pv indicates the modifyOtherKeys level
const resource_pattern = "\<Esc>P[01]+R.*\<Esc>\\\\" const modkeys_pattern = "\<Esc>\\[>4;\\dm"
# Pattern that matches the line with the status. Currently what terminals # Pattern that matches the line with the status. Currently what terminals
# return for the Kitty keyboard protocol. # return for the Kitty keyboard protocol.
@@ -264,7 +263,7 @@ def DoTerm(name: string)
keycodes[name]['protocol'] = proto_name keycodes[name]['protocol'] = proto_name
keycodes[name]['version'] = '' keycodes[name]['version'] = ''
keycodes[name]['status'] = '' keycodes[name]['status'] = ''
keycodes[name]['resource'] = '' keycodes[name]['modkeys'] = ''
# Check the log file for a status and the version response # Check the log file for a status and the version response
ch_logfile('', '') ch_logfile('', '')
@@ -275,16 +274,16 @@ def DoTerm(name: string)
if line =~ 'raw key input' if line =~ 'raw key input'
var code = substitute(line, '.*raw key input: "\([^"]*\).*', '\1', '') var code = substitute(line, '.*raw key input: "\([^"]*\).*', '\1', '')
# Check for resource value response # Check for the XTQMODKEYS response.
if code =~ resource_pattern if code =~ modkeys_pattern
var resource = substitute(code, '.*\(' .. resource_pattern .. '\).*', '\1', '') var modkeys = substitute(code, '.*\(' .. modkeys_pattern .. '\).*', '\1', '')
# use the value as the resource, "=30" means zero # Get the level out of the response
resource = substitute(resource, '.*\(=\p\+\).*', '\1', '') modkeys = substitute(modkeys, '.*4;\(\d\)m', '\1', '')
if keycodes[name]['resource'] != '' if keycodes[name]['modkeys'] != ''
echomsg 'Another resource found after ' .. keycodes[name]['resource'] echomsg 'Another modkeys found after ' .. keycodes[name]['modkeys']
endif endif
keycodes[name]['resource'] = resource keycodes[name]['modkeys'] = modkeys
endif endif
# Check for kitty keyboard protocol status # Check for kitty keyboard protocol status

View File

@@ -2,6 +2,12 @@
" Only load this once. " Only load this once.
if 1 if 1
" When using xterm version 377 the response to the modifyOtherKeys status
" interferes with some tests. Remove the request from the t_TI termcap
" entry.
let &t_TI = substitute(&t_TI, "\<Esc>\\[?4m", '', '')
if exists('s:did_load') if exists('s:did_load')
finish finish
endif endif

View File

@@ -7,6 +7,13 @@ endif
source view_util.vim source view_util.vim
" When 'term' is changed some status requests may be sent. The responses may
" interfere with what is being tested. A short sleep is used to process any of
" those responses first.
func WaitForResponses()
sleep 50m
endfunc
" Get the name of the Python executable. " Get the name of the Python executable.
" Also keeps it in s:python. " Also keeps it in s:python.
func PythonProg() func PythonProg()

View File

@@ -478,10 +478,24 @@ func Test_list_mappings()
\ execute('nmap ,n')->trim()->split("\n")) \ execute('nmap ,n')->trim()->split("\n"))
" verbose map " verbose map
" first line might be "seen modifyOtherKeys"
let lines = execute('verbose map ,n')->trim()->split("\n") let lines = execute('verbose map ,n')->trim()->split("\n")
" Remove "Seen modifyOtherKeys" and other optional info.
if lines[0] =~ 'Seen modifyOtherKeys'
call remove(lines, 0)
endif
if lines[0] =~ 'modifyOtherKeys detected:'
call remove(lines, 0)
endif
if lines[0] =~ 'Kitty keyboard protocol:'
call remove(lines, 0)
endif
if lines[0] == ''
call remove(lines, 0)
endif
let index = indexof(lines, 'v:val =~ "Last set"') let index = indexof(lines, 'v:val =~ "Last set"')
call assert_inrange(1, 2, index) call assert_equal(1, index)
call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$", call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$",
\ lines[index]) \ lines[index])

View File

@@ -5,6 +5,7 @@ source check.vim
CheckNotGui CheckNotGui
CheckUnix CheckUnix
source shared.vim
source mouse.vim source mouse.vim
" Test for modeless characterwise selection (single click) " Test for modeless characterwise selection (single click)
@@ -15,10 +16,15 @@ func Test_modeless_characterwise_selection()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200 set mouse=a term=xterm mousetime=200
call WaitForResponses()
new new
call setline(1, ['one two three', 'foo bar baz']) call setline(1, ['one two three', 'foo bar baz'])
redraw! redraw!
" Wait a bit for any terminal responses to get processed.
sleep 50m
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
exe 'set ttymouse=' .. ttymouse_val exe 'set ttymouse=' .. ttymouse_val
@@ -250,6 +256,8 @@ func Test_modeless_word_selection()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200 set mouse=a term=xterm mousetime=200
call WaitForResponses()
new new
call setline(1, ['one two three', 'foo bar baz']) call setline(1, ['one two three', 'foo bar baz'])
redraw! redraw!
@@ -330,6 +338,8 @@ func Test_modeless_line_selection()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200 set mouse=a term=xterm mousetime=200
call WaitForResponses()
new new
call setline(1, ['one two three', 'foo bar baz']) call setline(1, ['one two three', 'foo bar baz'])
redraw! redraw!

View File

@@ -3102,15 +3102,18 @@ endfunc
func Test_normal50_commandline() func Test_normal50_commandline()
CheckFeature timers CheckFeature timers
CheckFeature cmdline_hist CheckFeature cmdline_hist
func! DoTimerWork(id) func! DoTimerWork(id)
call assert_equal('[Command Line]', bufname('')) call assert_equal('[Command Line]', bufname(''))
" should fail, with E11, but does fail with E23? " should fail, with E11, but does fail with E23?
"call feedkeys("\<c-^>", 'tm') "call feedkeys("\<c-^>", 'tm')
" should also fail with E11 " should fail with E11 - "Invalid in command-line window"
call assert_fails(":wincmd p", 'E11:') call assert_fails(":wincmd p", 'E11:')
" return from commandline window
call feedkeys("\<cr>") " Return from commandline window.
call feedkeys("\<CR>", 't')
endfunc endfunc
let oldlang=v:lang let oldlang=v:lang
@@ -3123,7 +3126,9 @@ func Test_normal50_commandline()
catch /E23/ catch /E23/
" no-op " no-op
endtry endtry
" clean up " clean up
delfunc DoTimerWork
set updatetime=4000 set updatetime=4000
exe "lang" oldlang exe "lang" oldlang
bw! bw!

View File

@@ -17,6 +17,8 @@ func Test_term_mouse_left_click()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer']) call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer'])
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
@@ -47,6 +49,7 @@ func Test_xterm_mouse_right_click_extends_visual()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
for visual_mode in ["v", "V", "\<C-V>"] for visual_mode in ["v", "V", "\<C-V>"]
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
@@ -118,6 +121,7 @@ func Test_xterm_mouse_tagjump()
let save_term = &term let save_term = &term
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values for ttymouse_val in g:Ttymouse_values
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -192,6 +196,7 @@ func Test_term_mouse_middle_click()
let save_quotestar = @* let save_quotestar = @*
let save_quoteplus = @+ let save_quoteplus = @+
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -277,6 +282,7 @@ func Test_term_mouse_middle_click_no_clipboard()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -307,6 +313,7 @@ func Test_term_mouse_middle_click_insert_mode()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -349,6 +356,7 @@ func Test_term_mouse_switch_win_insert_mode()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2 set mouse=a term=xterm ttymouse=xterm2
call WaitForResponses()
call feedkeys('ivim' .. call feedkeys('ivim' ..
\ MouseLeftClickCode(8, 6) .. MouseLeftReleaseCode(8, 6) .. \ MouseLeftClickCode(8, 6) .. MouseLeftReleaseCode(8, 6) ..
@@ -372,6 +380,8 @@ func Test_mouse_cmdwin_resize()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2 set mouse=a term=xterm ttymouse=xterm2
call WaitForResponses()
5new 5new
redraw! redraw!
@@ -400,6 +410,8 @@ func Test_1xterm_mouse_wheel()
let save_wrap = &wrap let save_wrap = &wrap
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
set mouse=a term=xterm nowrap set mouse=a term=xterm nowrap
call WaitForResponses()
call setline(1, range(100000000000000, 100000000000100)) call setline(1, range(100000000000000, 100000000000100))
for ttymouse_val in g:Ttymouse_values for ttymouse_val in g:Ttymouse_values
@@ -461,6 +473,8 @@ func Test_term_mouse_drag_beyond_window()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
let col = 1 let col = 1
call setline(1, range(1, 100)) call setline(1, range(1, 100))
@@ -546,6 +560,7 @@ func Test_term_mouse_drag_window_separator()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -605,6 +620,7 @@ func Test_term_mouse_drag_statusline()
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
let save_laststatus = &laststatus let save_laststatus = &laststatus
set mouse=a term=xterm laststatus=2 set mouse=a term=xterm laststatus=2
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -647,6 +663,8 @@ func Test_term_mouse_click_tab()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
let row = 1 let row = 1
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
@@ -696,6 +714,8 @@ func Test_term_mouse_click_X_to_close_tab()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
let row = 1 let row = 1
let col = &columns let col = &columns
@@ -745,6 +765,8 @@ func Test_term_mouse_drag_to_move_tab()
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
" Set 'mousetime' to 1 to avoid recognizing a double-click in the loop " Set 'mousetime' to 1 to avoid recognizing a double-click in the loop
set mouse=a term=xterm mousetime=1 set mouse=a term=xterm mousetime=1
call WaitForResponses()
let row = 1 let row = 1
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
@@ -820,6 +842,8 @@ func Test_term_mouse_double_click_to_create_tab()
" Set 'mousetime' to a small value, so that double-click works but we don't " Set 'mousetime' to a small value, so that double-click works but we don't
" have to wait long to avoid a triple-click. " have to wait long to avoid a triple-click.
set mouse=a term=xterm mousetime=200 set mouse=a term=xterm mousetime=200
call WaitForResponses()
let row = 1 let row = 1
let col = 10 let col = 10
@@ -877,6 +901,8 @@ func Test_term_mouse_multiple_clicks_to_visually_select()
" 'mousetime' must be sufficiently large, or else the test is flaky when " 'mousetime' must be sufficiently large, or else the test is flaky when
" using a ssh connection with X forwarding; i.e. ssh -X (issue #7563). " using a ssh connection with X forwarding; i.e. ssh -X (issue #7563).
set mouse=a term=xterm mousetime=600 set mouse=a term=xterm mousetime=600
call WaitForResponses()
new new
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
@@ -1002,6 +1028,8 @@ func Test_mouse_alt_leftclick()
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200 set mouse=a term=xterm mousetime=200
set mousemodel=popup set mousemodel=popup
call WaitForResponses()
new new
call setline(1, 'one (two) three') call setline(1, 'one (two) three')
@@ -1036,6 +1064,7 @@ func Test_xterm_mouse_click_in_fold_columns()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
let save_foldcolumn = &foldcolumn let save_foldcolumn = &foldcolumn
set mouse=a term=xterm foldcolumn=3 ttymouse=xterm2 set mouse=a term=xterm foldcolumn=3 ttymouse=xterm2
call WaitForResponses()
" Create 2 nested folds. " Create 2 nested folds.
call setline(1, range(1, 7)) call setline(1, range(1, 7))
@@ -1087,6 +1116,8 @@ func Test_term_mouse_click_in_cmdline_to_set_pos()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
let row = &lines let row = &lines
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
@@ -1121,6 +1152,8 @@ func Test_term_mouse_middle_click_in_cmdline_to_paste()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm set mouse=a term=xterm
call WaitForResponses()
let row = &lines let row = &lines
" Column values does not matter, paste is done at position of cursor. " Column values does not matter, paste is done at position of cursor.
let col = 1 let col = 1
@@ -1155,6 +1188,7 @@ func Test_term_mouse_shift_middle_click()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2 mousemodel= set mouse=a term=xterm ttymouse=xterm2 mousemodel=
call WaitForResponses()
call test_setmouse(1, 1) call test_setmouse(1, 1)
exe "normal \<S-MiddleMouse>" exe "normal \<S-MiddleMouse>"
@@ -1177,6 +1211,7 @@ func Test_term_mouse_visual_mode()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set term=xterm ttymouse=xterm2 set term=xterm ttymouse=xterm2
call WaitForResponses()
" If visual mode is not present in 'mouse', then left click should not " If visual mode is not present in 'mouse', then left click should not
" do anything in visal mode. " do anything in visal mode.
@@ -1258,6 +1293,7 @@ func Test_term_mouse_popup_menu()
let save_mousemodel = &mousemodel let save_mousemodel = &mousemodel
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousemodel=popup set mouse=a term=xterm mousemodel=popup
call WaitForResponses()
menu PopUp.foo :let g:menustr = 'foo'<CR> menu PopUp.foo :let g:menustr = 'foo'<CR>
menu PopUp.bar :let g:menustr = 'bar'<CR> menu PopUp.bar :let g:menustr = 'bar'<CR>
@@ -1294,6 +1330,7 @@ func Test_term_mouse_popup_menu_setpos()
let save_mousemodel = &mousemodel let save_mousemodel = &mousemodel
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousemodel=popup_setpos set mouse=a term=xterm mousemodel=popup_setpos
call WaitForResponses()
nmenu PopUp.foo :let g:menustr = 'foo'<CR> nmenu PopUp.foo :let g:menustr = 'foo'<CR>
nmenu PopUp.bar :let g:menustr = 'bar'<CR> nmenu PopUp.bar :let g:menustr = 'bar'<CR>
@@ -1416,6 +1453,7 @@ func Test_term_mouse_search()
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2 set mouse=a term=xterm ttymouse=xterm2
set mousemodel= set mousemodel=
call WaitForResponses()
" In normal mode, Shift-Left or Shift-Right click should search for the word " In normal mode, Shift-Left or Shift-Right click should search for the word
" under the cursor. " under the cursor.
@@ -1453,6 +1491,7 @@ func Test_term_mouse_quickfix_window()
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2 set mouse=a term=xterm ttymouse=xterm2
set mousemodel= set mousemodel=
call WaitForResponses()
cgetexpr "Xfile1:1:L1" cgetexpr "Xfile1:1:L1"
copen 5 copen 5
@@ -1482,6 +1521,7 @@ func Test_term_mouse_help_window()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=h term=xterm mousetime=200 set mouse=h term=xterm mousetime=200
call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val let msg = 'ttymouse=' .. ttymouse_val
@@ -1518,6 +1558,7 @@ func Test_mouse_termcodes()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200 set mouse=a term=xterm mousetime=200
call WaitForResponses()
new new
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
@@ -1884,6 +1925,8 @@ func Test_xx07_xterm_response()
" xterm < 95: "xterm" (actually unmodified) " xterm < 95: "xterm" (actually unmodified)
set t_RV= set t_RV=
set term=xterm set term=xterm
call WaitForResponses()
set t_RV=x set t_RV=x
set ttymouse=xterm set ttymouse=xterm
call test_option_not_set('ttymouse') call test_option_not_set('ttymouse')
@@ -1969,6 +2012,7 @@ func Test_focus_events()
let save_term = &term let save_term = &term
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
set term=xterm ttymouse=xterm2 set term=xterm ttymouse=xterm2
call WaitForResponses()
au FocusGained * let g:focus_gained += 1 au FocusGained * let g:focus_gained += 1
au FocusLost * let g:focus_lost += 1 au FocusLost * let g:focus_lost += 1
@@ -2159,6 +2203,8 @@ func Test_CSIu_keys_without_modifiers()
" make this execute faster " make this execute faster
set timeoutlen=10 set timeoutlen=10
call WaitForResponses()
" Escape sent as `CSI 27 u` should act as normal escape and not undo " Escape sent as `CSI 27 u` should act as normal escape and not undo
call setline(1, 'a') call setline(1, 'a')
call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\e"), 'Lx!') call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\e"), 'Lx!')
@@ -2186,6 +2232,7 @@ func Test_ignore_dec_mouse()
let save_ttymouse = &ttymouse let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1) call test_override('no_query_mouse', 1)
set mouse=a term=gnome ttymouse= set mouse=a term=gnome ttymouse=
call WaitForResponses()
execute "set <xF1>=\<Esc>[1;*P" execute "set <xF1>=\<Esc>[1;*P"
nnoremap <S-F1> agot it<Esc> nnoremap <S-F1> agot it<Esc>
@@ -2431,6 +2478,9 @@ endfunc
func Test_insert_literal() func Test_insert_literal()
set timeoutlen=10 set timeoutlen=10
call WaitForResponses()
new new
" CTRL-V CTRL-X inserts a ^X " CTRL-V CTRL-X inserts a ^X
call feedkeys('a' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!') call feedkeys('a' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!')

View File

@@ -695,6 +695,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 */
/**/
954,
/**/ /**/
953, 953,
/**/ /**/