Patch 9.0.0954
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.
Files: src/term.c, src/globals.h, src/getchar.c, src/map.c,
src/testdir/keycode_check.vim, src/testdir/keycode_check.json,
src/testdir/test_mapping.vim, src/testdir/test_modeless.vim,
src/testdir/test_normal.vim, src/testdir/test_termcodes.vim,
src/testdir/shared.vim, src/testdir/setup.vim
*** ../vim-9.0.0953/src/term.c 2022-11-25 15:09:30.710402884 +0000
--- src/term.c 2022-11-26 16:15:53.243280411 +0000
***************
*** 450,456 ****
{(int)KS_TI, "\0337\033[?47h"},
{(int)KS_TE, "\033[?47l\0338"},
# endif
! {(int)KS_CTI, "\033[>4;2m"},
{(int)KS_CTE, "\033[>4;m"},
{(int)KS_CIS, "\033]1;"},
{(int)KS_CIE, "\007"},
--- 450,456 ----
{(int)KS_TI, "\0337\033[?47h"},
{(int)KS_TE, "\033[?47l\0338"},
# endif
! {(int)KS_CTI, "\033[>4;2m\033[?4m"}, // see "builtin_mok2"
{(int)KS_CTE, "\033[>4;m"},
{(int)KS_CIS, "\033]1;"},
{(int)KS_CIE, "\007"},
***************
*** 591,597 ****
* xterm.
*/
static tcap_entry_T builtin_mok2[] = {
! {(int)KS_CTI, "\033[>4;2m"},
{(int)KS_CTE, "\033[>4;m"},
{(int)KS_NAME, NULL} // end marker
--- 591,600 ----
* xterm.
*/
static tcap_entry_T builtin_mok2[] = {
! // 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_NAME, NULL} // end marker
***************
*** 3661,3669 ****
out_str(T_CTE);
// 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
! // again after the following t_TI. We assume that when seenModifyOtherKeys
! // was set before it will still be valid.
// 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
--- 3664,3683 ----
out_str(T_CTE);
// The seenModifyOtherKeys flag is not reset here. We do expect t_TE to
! // disable modifyOtherKeys, but until Xterm version 377 there is no way to
! // detect it's enabled again after the following t_TI. We assume that when
! // 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
// it. Remembering that it was detected to be enabled is useful in some
***************
*** 5112,5117 ****
--- 5126,5133 ----
* Handle a CSI escape sequence.
* - Xterm version string.
*
+ * - Response to XTQMODKEYS: "{lead} > 4 ; Pv m".
+ *
* - Cursor position report: {lead}{row};{col}R
* The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
***************
*** 5121,5126 ****
--- 5137,5143 ----
* - key with modifiers when modifyOtherKeys is enabled:
* {lead}27;{modifier};{key}~
* {lead}{key};{modifier}u
+ *
* Return 0 for no match, -1 for partial match, > 0 for full match.
*/
static int
***************
*** 5184,5195 ****
trail = *ap;
csi_len = (int)(ap - tp) + 1;
// Cursor position report: Eat it when there are 2 arguments
// 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
// <S-F3>, it sends something similar, check for row and column
// to make sense.
! if (first == -1 && argc == 2 && trail == 'R')
{
handle_u7_response(arg, tp, csi_len);
--- 5201,5224 ----
trail = *ap;
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
// 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
// <S-F3>, it sends something similar, check for row and column
// to make sense.
! else if (first == -1 && argc == 2 && trail == 'R')
{
handle_u7_response(arg, tp, csi_len);
***************
*** 5822,5827 ****
--- 5851,5858 ----
* Also eat other possible responses to t_RV, rxvt returns
* "{lead}?1;2c".
*
+ * - Response to XTQMODKEYS: "{lead} > 4 ; Pv m".
+ *
* - Cursor position report: {lead}{row};{col}R
* The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
*** ../vim-9.0.0953/src/globals.h 2022-11-23 20:19:17.129682462 +0000
--- src/globals.h 2022-11-26 13:47:57.139680870 +0000
***************
*** 1374,1382 ****
EXTERN int pending_end_reg_executing INIT(= 0);
// Set when a modifyOtherKeys sequence was seen, then simplified mappings will
! // no longer be used.
EXTERN int seenModifyOtherKeys INIT(= FALSE);
// The state for the Kitty keyboard protocol.
typedef enum {
// Initially we have no clue if the protocol is on or off.
--- 1374,1402 ----
EXTERN int pending_end_reg_executing INIT(= 0);
// Set when a modifyOtherKeys sequence was seen, then simplified mappings will
! // no longer be used. To be combined with modify_otherkeys_state.
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.
typedef enum {
// Initially we have no clue if the protocol is on or off.
*** ../vim-9.0.0953/src/getchar.c 2022-11-24 20:23:20.955119797 +0000
--- src/getchar.c 2022-11-26 16:16:49.547254109 +0000
***************
*** 2463,2469 ****
static int
key_protocol_enabled(void)
{
! return seenModifyOtherKeys || kitty_protocol_state == KKPS_ENABLED;
}
/*
--- 2463,2473 ----
static int
key_protocol_enabled(void)
{
! // 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;
}
/*
*** ../vim-9.0.0953/src/map.c 2022-11-23 20:19:17.133682464 +0000
--- src/map.c 2022-11-26 14:09:26.319444398 +0000
***************
*** 315,321 ****
if (p_verbose > 0 && keyround == 1)
{
if (seenModifyOtherKeys)
! msg_puts(_("Seen modifyOtherKeys: true"));
if (kitty_protocol_state != KKPS_INITIAL)
{
char *name = _("Unknown");
--- 315,340 ----
if (p_verbose > 0 && keyround == 1)
{
if (seenModifyOtherKeys)
! 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)
{
char *name = _("Unknown");
***************
*** 329,335 ****
}
char buf[200];
! vim_snprintf(buf, sizeof(buf), _("Kitty keyboard protocol: %s"), name);
msg_puts(buf);
}
}
--- 348,355 ----
}
char buf[200];
! vim_snprintf(buf, sizeof(buf),
! _("Kitty keyboard protocol: %s\n"), name);
msg_puts(buf);
}
}
*** ../vim-9.0.0953/src/testdir/keycode_check.vim 2022-11-19 19:02:33.957452667 +0000
--- src/testdir/keycode_check.vim 2022-11-26 14:18:47.139289668 +0000
***************
*** 134,140 ****
endif
sort(terms)
! var items = ['protocol', 'version', 'status', 'resource']
+ key_entries->copy()->map((_, v) => v[1])
# For each terminal compute the needed width, add two.
--- 134,140 ----
endif
sort(terms)
! var items = ['protocol', 'version', 'status', 'modkeys']
+ key_entries->copy()->map((_, v) => v[1])
# For each terminal compute the needed width, add two.
***************
*** 198,206 ****
if proto == 1
&t_TI = ""
elseif proto == 2
! # Enable modifyOtherKeys level 2
! # Request the resource value: DCS + Q modifyOtherKeys ST
! &t_TI = "\<Esc>[>4;2m" .. "\<Esc>P+Q6d6f646966794f746865724b657973\<Esc>\\"
proto_name = 'mok2'
elseif proto == 3
# Enable Kitty keyboard protocol and request the status
--- 198,205 ----
if proto == 1
&t_TI = ""
elseif proto == 2
! # Enable modifyOtherKeys level 2. Request the XTQMODKEYS value.
! &t_TI = "\<Esc>[>4;2m" .. "\<Esc>[?4m"
proto_name = 'mok2'
elseif proto == 3
# Enable Kitty keyboard protocol and request the status
***************
*** 218,227 ****
# Pattern that matches the line with the version response.
const version_pattern = "\<Esc>\\[>\\d\\+;\\d\\+;\\d*c"
! # Pattern that matches the resource value response:
! # DCS 1 + R Pt ST valid
! # DCS 0 + R Pt ST invalid
! const resource_pattern = "\<Esc>P[01]+R.*\<Esc>\\\\"
# Pattern that matches the line with the status. Currently what terminals
# return for the Kitty keyboard protocol.
--- 217,226 ----
# Pattern that matches the line with the version response.
const version_pattern = "\<Esc>\\[>\\d\\+;\\d\\+;\\d*c"
! # Pattern that matches the XTQMODKEYS response:
! # CSI > 4;Pv m
! # where Pv indicates the modifyOtherKeys level
! const modkeys_pattern = "\<Esc>\\[>4;\\dm"
# Pattern that matches the line with the status. Currently what terminals
# return for the Kitty keyboard protocol.
***************
*** 264,270 ****
keycodes[name]['protocol'] = proto_name
keycodes[name]['version'] = ''
keycodes[name]['status'] = ''
! keycodes[name]['resource'] = ''
# Check the log file for a status and the version response
ch_logfile('', '')
--- 263,269 ----
keycodes[name]['protocol'] = proto_name
keycodes[name]['version'] = ''
keycodes[name]['status'] = ''
! keycodes[name]['modkeys'] = ''
# Check the log file for a status and the version response
ch_logfile('', '')
***************
*** 275,290 ****
if line =~ 'raw key input'
var code = substitute(line, '.*raw key input: "\([^"]*\).*', '\1', '')
! # Check for resource value response
! if code =~ resource_pattern
! var resource = substitute(code, '.*\(' .. resource_pattern .. '\).*', '\1', '')
! # use the value as the resource, "=30" means zero
! resource = substitute(resource, '.*\(=\p\+\).*', '\1', '')
! if keycodes[name]['resource'] != ''
! echomsg 'Another resource found after ' .. keycodes[name]['resource']
endif
! keycodes[name]['resource'] = resource
endif
# Check for kitty keyboard protocol status
--- 274,289 ----
if line =~ 'raw key input'
var code = substitute(line, '.*raw key input: "\([^"]*\).*', '\1', '')
! # Check for the XTQMODKEYS response.
! if code =~ modkeys_pattern
! var modkeys = substitute(code, '.*\(' .. modkeys_pattern .. '\).*', '\1', '')
! # Get the level out of the response
! modkeys = substitute(modkeys, '.*4;\(\d\)m', '\1', '')
! if keycodes[name]['modkeys'] != ''
! echomsg 'Another modkeys found after ' .. keycodes[name]['modkeys']
endif
! keycodes[name]['modkeys'] = modkeys
endif
# Check for kitty keyboard protocol status
*** ../vim-9.0.0953/src/testdir/keycode_check.json 2022-11-23 20:19:17.133682464 +0000
--- src/testdir/keycode_check.json 2022-11-26 19:14:14.718448992 +0000
***************
*** 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":"1
b","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"}}
--- 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":"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"}}
*** ../vim-9.0.0953/src/testdir/test_mapping.vim 2022-11-13 20:43:14.932366214 +0000
--- src/testdir/test_mapping.vim 2022-11-26 18:14:30.441480409 +0000
***************
*** 478,487 ****
\ execute('nmap ,n')->trim()->split("\n"))
" verbose map
- " first line might be "seen modifyOtherKeys"
let lines = execute('verbose map ,n')->trim()->split("\n")
let index = indexof(lines, 'v:val =~ "Last set"')
! call assert_inrange(1, 2, index)
call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$",
\ lines[index])
--- 478,501 ----
\ execute('nmap ,n')->trim()->split("\n"))
" verbose map
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"')
! call assert_equal(1, index)
call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$",
\ lines[index])
*** ../vim-9.0.0953/src/testdir/test_modeless.vim 2020-05-11 20:31:24.000000000 +0100
--- src/testdir/test_modeless.vim 2022-11-26 18:49:05.727745307 +0000
***************
*** 5,10 ****
--- 5,11 ----
CheckNotGui
CheckUnix
+ source shared.vim
source mouse.vim
" Test for modeless characterwise selection (single click)
***************
*** 15,24 ****
--- 16,30 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200
+ call WaitForResponses()
+
new
call setline(1, ['one two three', 'foo bar baz'])
redraw!
+ " Wait a bit for any terminal responses to get processed.
+ sleep 50m
+
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
exe 'set ttymouse=' .. ttymouse_val
***************
*** 250,255 ****
--- 256,263 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200
+ call WaitForResponses()
+
new
call setline(1, ['one two three', 'foo bar baz'])
redraw!
***************
*** 330,335 ****
--- 338,345 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200
+ call WaitForResponses()
+
new
call setline(1, ['one two three', 'foo bar baz'])
redraw!
*** ../vim-9.0.0953/src/testdir/test_normal.vim 2022-11-15 13:46:08.473979055 +0000
--- src/testdir/test_normal.vim 2022-11-26 18:17:50.813299753 +0000
***************
*** 3102,3116 ****
func Test_normal50_commandline()
CheckFeature timers
CheckFeature cmdline_hist
func! DoTimerWork(id)
call assert_equal('[Command Line]', bufname(''))
" should fail, with E11, but does fail with E23?
"call feedkeys("\<c-^>", 'tm')
! " should also fail with E11
call assert_fails(":wincmd p", 'E11:')
! " return from commandline window
! call feedkeys("\<cr>")
endfunc
let oldlang=v:lang
--- 3102,3119 ----
func Test_normal50_commandline()
CheckFeature timers
CheckFeature cmdline_hist
+
func! DoTimerWork(id)
call assert_equal('[Command Line]', bufname(''))
+
" should fail, with E11, but does fail with E23?
"call feedkeys("\<c-^>", 'tm')
! " should fail with E11 - "Invalid in command-line window"
call assert_fails(":wincmd p", 'E11:')
!
! " Return from commandline window.
! call feedkeys("\<CR>", 't')
endfunc
let oldlang=v:lang
***************
*** 3123,3129 ****
--- 3126,3134 ----
catch /E23/
" no-op
endtry
+
" clean up
+ delfunc DoTimerWork
set updatetime=4000
exe "lang" oldlang
bw!
*** ../vim-9.0.0953/src/testdir/test_termcodes.vim 2022-11-24 14:05:15.526236452 +0000
--- src/testdir/test_termcodes.vim 2022-11-26 18:49:49.563709733 +0000
***************
*** 17,22 ****
--- 17,24 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
+
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
***************
*** 47,52 ****
--- 49,55 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
for visual_mode in ["v", "V", "\<C-V>"]
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
***************
*** 118,123 ****
--- 121,127 ----
let save_term = &term
let save_ttymouse = &ttymouse
set mouse=a term=xterm
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 192,197 ****
--- 196,202 ----
let save_quotestar = @*
let save_quoteplus = @+
set mouse=a term=xterm
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 277,282 ****
--- 282,288 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 307,312 ****
--- 313,319 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 349,354 ****
--- 356,362 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2
+ call WaitForResponses()
call feedkeys('ivim' ..
\ MouseLeftClickCode(8, 6) .. MouseLeftReleaseCode(8, 6) ..
***************
*** 372,377 ****
--- 380,387 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2
+ call WaitForResponses()
+
5new
redraw!
***************
*** 400,405 ****
--- 410,417 ----
let save_wrap = &wrap
let save_ttymouse = &ttymouse
set mouse=a term=xterm nowrap
+ call WaitForResponses()
+
call setline(1, range(100000000000000, 100000000000100))
for ttymouse_val in g:Ttymouse_values
***************
*** 461,466 ****
--- 473,480 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
+
let col = 1
call setline(1, range(1, 100))
***************
*** 546,551 ****
--- 560,566 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 605,610 ****
--- 620,626 ----
call test_override('no_query_mouse', 1)
let save_laststatus = &laststatus
set mouse=a term=xterm laststatus=2
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 647,652 ****
--- 663,670 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
+
let row = 1
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
***************
*** 696,701 ****
--- 714,721 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
+
let row = 1
let col = &columns
***************
*** 745,750 ****
--- 765,772 ----
call test_override('no_query_mouse', 1)
" Set 'mousetime' to 1 to avoid recognizing a double-click in the loop
set mouse=a term=xterm mousetime=1
+ call WaitForResponses()
+
let row = 1
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
***************
*** 820,825 ****
--- 842,849 ----
" Set 'mousetime' to a small value, so that double-click works but we don't
" have to wait long to avoid a triple-click.
set mouse=a term=xterm mousetime=200
+ call WaitForResponses()
+
let row = 1
let col = 10
***************
*** 877,882 ****
--- 901,908 ----
" '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).
set mouse=a term=xterm mousetime=600
+ call WaitForResponses()
+
new
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
***************
*** 1002,1007 ****
--- 1028,1035 ----
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200
set mousemodel=popup
+ call WaitForResponses()
+
new
call setline(1, 'one (two) three')
***************
*** 1036,1041 ****
--- 1064,1070 ----
let save_ttymouse = &ttymouse
let save_foldcolumn = &foldcolumn
set mouse=a term=xterm foldcolumn=3 ttymouse=xterm2
+ call WaitForResponses()
" Create 2 nested folds.
call setline(1, range(1, 7))
***************
*** 1087,1092 ****
--- 1116,1123 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
+
let row = &lines
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
***************
*** 1121,1126 ****
--- 1152,1159 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm
+ call WaitForResponses()
+
let row = &lines
" Column values does not matter, paste is done at position of cursor.
let col = 1
***************
*** 1155,1160 ****
--- 1188,1194 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2 mousemodel=
+ call WaitForResponses()
call test_setmouse(1, 1)
exe "normal \<S-MiddleMouse>"
***************
*** 1177,1182 ****
--- 1211,1217 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set term=xterm ttymouse=xterm2
+ call WaitForResponses()
" If visual mode is not present in 'mouse', then left click should not
" do anything in visal mode.
***************
*** 1258,1263 ****
--- 1293,1299 ----
let save_mousemodel = &mousemodel
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousemodel=popup
+ call WaitForResponses()
menu PopUp.foo :let g:menustr = 'foo'<CR>
menu PopUp.bar :let g:menustr = 'bar'<CR>
***************
*** 1294,1299 ****
--- 1330,1336 ----
let save_mousemodel = &mousemodel
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousemodel=popup_setpos
+ call WaitForResponses()
nmenu PopUp.foo :let g:menustr = 'foo'<CR>
nmenu PopUp.bar :let g:menustr = 'bar'<CR>
***************
*** 1416,1421 ****
--- 1453,1459 ----
call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2
set mousemodel=
+ call WaitForResponses()
" In normal mode, Shift-Left or Shift-Right click should search for the word
" under the cursor.
***************
*** 1453,1458 ****
--- 1491,1497 ----
call test_override('no_query_mouse', 1)
set mouse=a term=xterm ttymouse=xterm2
set mousemodel=
+ call WaitForResponses()
cgetexpr "Xfile1:1:L1"
copen 5
***************
*** 1482,1487 ****
--- 1521,1527 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=h term=xterm mousetime=200
+ call WaitForResponses()
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
let msg = 'ttymouse=' .. ttymouse_val
***************
*** 1518,1523 ****
--- 1558,1564 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=xterm mousetime=200
+ call WaitForResponses()
new
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
***************
*** 1884,1889 ****
--- 1925,1932 ----
" xterm < 95: "xterm" (actually unmodified)
set t_RV=
set term=xterm
+ call WaitForResponses()
+
set t_RV=x
set ttymouse=xterm
call test_option_not_set('ttymouse')
***************
*** 1969,1974 ****
--- 2012,2018 ----
let save_term = &term
let save_ttymouse = &ttymouse
set term=xterm ttymouse=xterm2
+ call WaitForResponses()
au FocusGained * let g:focus_gained += 1
au FocusLost * let g:focus_lost += 1
***************
*** 2159,2164 ****
--- 2203,2210 ----
" make this execute faster
set timeoutlen=10
+ call WaitForResponses()
+
" Escape sent as `CSI 27 u` should act as normal escape and not undo
call setline(1, 'a')
call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\e"), 'Lx!')
***************
*** 2186,2191 ****
--- 2232,2238 ----
let save_ttymouse = &ttymouse
call test_override('no_query_mouse', 1)
set mouse=a term=gnome ttymouse=
+ call WaitForResponses()
execute "set <xF1>=\<Esc>[1;*P"
nnoremap <S-F1> agot it<Esc>
***************
*** 2431,2436 ****
--- 2478,2486 ----
func Test_insert_literal()
set timeoutlen=10
+
+ call WaitForResponses()
+
new
" CTRL-V CTRL-X inserts a ^X
call feedkeys('a' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!')
*** ../vim-9.0.0953/src/testdir/shared.vim 2022-11-10 18:21:26.099027074 +0000
--- src/testdir/shared.vim 2022-11-26 18:48:19.707782613 +0000
***************
*** 7,12 ****
--- 7,19 ----
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.
" Also keeps it in s:python.
func PythonProg()
*** ../vim-9.0.0953/src/testdir/setup.vim 2017-09-03 13:28:47.000000000 +0100
--- src/testdir/setup.vim 2022-11-26 18:13:48.309519412 +0000
***************
*** 2,7 ****
--- 2,13 ----
" Only load this once.
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')
finish
endif
*** ../vim-9.0.0953/src/version.c 2022-11-26 18:59:15.555251083 +0000
--- src/version.c 2022-11-26 19:00:18.643199977 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 954,
/**/
--
hundred-and-one symptoms of being an internet addict:
150. You find yourself counting emoticons to get to sleep.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///