mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0051: MS-Windows: Key event test fail
Problem: MS-Windows: Key event test fail (after 9.1.0050) Solution: Catch Interrupt and return Ctrl-C Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
046a0f75d0
commit
f6ebaa7ae6
@ -1708,7 +1708,11 @@ func Test_gui_lowlevel_keyevent()
|
|||||||
" Test for <Ctrl-A> to <Ctrl-Z> keys
|
" Test for <Ctrl-A> to <Ctrl-Z> keys
|
||||||
for kc in range(65, 90)
|
for kc in range(65, 90)
|
||||||
call SendKeys([0x11, kc])
|
call SendKeys([0x11, kc])
|
||||||
let ch = getcharstr()
|
try
|
||||||
|
let ch = getcharstr()
|
||||||
|
catch /^Vim:Interrupt$/
|
||||||
|
let ch = "\<c-c>"
|
||||||
|
endtry
|
||||||
call assert_equal(nr2char(kc - 64), ch)
|
call assert_equal(nr2char(kc - 64), ch)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -36,6 +36,17 @@ func SendKey(key)
|
|||||||
call SendKeyWithModifiers(a:key, 0)
|
call SendKeyWithModifiers(a:key, 0)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" getcharstr(0) but catch Vim:Interrupt
|
||||||
|
func Getcharstr()
|
||||||
|
try
|
||||||
|
let ch = getcharstr(0)
|
||||||
|
catch /^Vim:Interrupt$/
|
||||||
|
let ch = "\<c-c>"
|
||||||
|
endtry
|
||||||
|
return ch
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
" Send a string of individual key-press events, without modifiers.
|
" Send a string of individual key-press events, without modifiers.
|
||||||
func SendKeyStr(keystring)
|
func SendKeyStr(keystring)
|
||||||
for k in a:keystring
|
for k in a:keystring
|
||||||
@ -347,7 +358,7 @@ func s:LoopTestKeyArray(arr)
|
|||||||
for [kcodes, kstr] in a:arr
|
for [kcodes, kstr] in a:arr
|
||||||
" Send as a sequence of key presses.
|
" Send as a sequence of key presses.
|
||||||
call SendKeyGroup(kcodes)
|
call SendKeyGroup(kcodes)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
" need to deal a bit differently with the non-printable ascii chars < 0x20
|
" need to deal a bit differently with the non-printable ascii chars < 0x20
|
||||||
if kstr < 0x20 && index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], kcodes[0]) >= 0
|
if kstr < 0x20 && index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], kcodes[0]) >= 0
|
||||||
call assert_equal(nr2char(kstr), $"{ch}")
|
call assert_equal(nr2char(kstr), $"{ch}")
|
||||||
@ -374,7 +385,7 @@ func s:LoopTestKeyArray(arr)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
call SendKeyWithModifiers(key, modifiers)
|
call SendKeyWithModifiers(key, modifiers)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
" need to deal a bit differently with the non-printable ascii chars < 0x20
|
" need to deal a bit differently with the non-printable ascii chars < 0x20
|
||||||
if kstr < 0x20 && index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], kcodes[0]) >= 0
|
if kstr < 0x20 && index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], kcodes[0]) >= 0
|
||||||
call assert_equal(nr2char(kstr), $"{ch}")
|
call assert_equal(nr2char(kstr), $"{ch}")
|
||||||
@ -408,10 +419,10 @@ func Test_mswin_event_character_keys()
|
|||||||
" (0x30 - 0x39) : VK_0 - VK_9 are the same as ASCII '0' - '9'
|
" (0x30 - 0x39) : VK_0 - VK_9 are the same as ASCII '0' - '9'
|
||||||
for kc in range(48, 57)
|
for kc in range(48, 57)
|
||||||
call SendKey(kc)
|
call SendKey(kc)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc), ch)
|
call assert_equal(nr2char(kc), ch)
|
||||||
call SendKeyWithModifiers(kc, 0)
|
call SendKeyWithModifiers(kc, 0)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc), ch)
|
call assert_equal(nr2char(kc), ch)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -437,10 +448,10 @@ func Test_mswin_event_character_keys()
|
|||||||
" numbered 32 higher than their uppercase versions.
|
" numbered 32 higher than their uppercase versions.
|
||||||
for kc in range(65, 90)
|
for kc in range(65, 90)
|
||||||
call SendKey(kc)
|
call SendKey(kc)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc + 32), ch)
|
call assert_equal(nr2char(kc + 32), ch)
|
||||||
call SendKeyWithModifiers(kc, 0)
|
call SendKeyWithModifiers(kc, 0)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc + 32), ch)
|
call assert_equal(nr2char(kc + 32), ch)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -449,10 +460,10 @@ func Test_mswin_event_character_keys()
|
|||||||
for modkey in [s:VK.SHIFT, s:VK.LSHIFT, s:VK.RSHIFT]
|
for modkey in [s:VK.SHIFT, s:VK.LSHIFT, s:VK.RSHIFT]
|
||||||
for kc in range(65, 90)
|
for kc in range(65, 90)
|
||||||
call SendKeyGroup([modkey, kc])
|
call SendKeyGroup([modkey, kc])
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc), ch)
|
call assert_equal(nr2char(kc), ch)
|
||||||
call SendKeyWithModifiers(kc, s:MOD_MASK_SHIFT)
|
call SendKeyWithModifiers(kc, s:MOD_MASK_SHIFT)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc), ch)
|
call assert_equal(nr2char(kc), ch)
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
@ -462,10 +473,10 @@ func Test_mswin_event_character_keys()
|
|||||||
for modkey in [s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL]
|
for modkey in [s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL]
|
||||||
for kc in range(65, 90)
|
for kc in range(65, 90)
|
||||||
call SendKeyGroup([modkey, kc])
|
call SendKeyGroup([modkey, kc])
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc - 64), ch)
|
call assert_equal(nr2char(kc - 64), ch)
|
||||||
call SendKeyWithModifiers(kc, s:MOD_MASK_CTRL)
|
call SendKeyWithModifiers(kc, s:MOD_MASK_CTRL)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(kc - 64), ch)
|
call assert_equal(nr2char(kc - 64), ch)
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
@ -518,7 +529,7 @@ func Test_mswin_event_function_keys()
|
|||||||
while getchar(0)
|
while getchar(0)
|
||||||
endwhile
|
endwhile
|
||||||
call SendKeyWithModifiers(111+n, vim_mod_mask)
|
call SendKeyWithModifiers(111+n, vim_mod_mask)
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
let mod_mask = getcharmod()
|
let mod_mask = getcharmod()
|
||||||
call assert_equal(keycode, $"{ch}", $"key = {kstr}")
|
call assert_equal(keycode, $"{ch}", $"key = {kstr}")
|
||||||
" workaround for the virtual termcap maps changing the character
|
" workaround for the virtual termcap maps changing the character
|
||||||
@ -590,21 +601,21 @@ func Test_mswin_event_movement_keys()
|
|||||||
while getchar(0)
|
while getchar(0)
|
||||||
endwhile
|
endwhile
|
||||||
execute 'call feedkeys("\<' .. kstr .. '>")'
|
execute 'call feedkeys("\<' .. kstr .. '>")'
|
||||||
let chstr_fk = getcharstr(0)
|
let chstr_fk = Getcharstr()
|
||||||
call assert_equal(chstr_eval, chstr_fk, $"feedkeys = <{kstr}>")
|
call assert_equal(chstr_eval, chstr_fk, $"feedkeys = <{kstr}>")
|
||||||
|
|
||||||
" flush out the typeahead buffer
|
" flush out the typeahead buffer
|
||||||
while getchar(0)
|
while getchar(0)
|
||||||
endwhile
|
endwhile
|
||||||
call SendKey(kcode)
|
call SendKey(kcode)
|
||||||
let chstr_alone = getcharstr(0)
|
let chstr_alone = Getcharstr()
|
||||||
let chstr_alone_end = chstr_alone[len(chstr_alone)-2:len(chstr_alone)-1]
|
let chstr_alone_end = chstr_alone[len(chstr_alone)-2:len(chstr_alone)-1]
|
||||||
|
|
||||||
" flush out the typeahead buffer
|
" flush out the typeahead buffer
|
||||||
while getchar(0)
|
while getchar(0)
|
||||||
endwhile
|
endwhile
|
||||||
call SendKeyGroup(mod_keycodes + [kcode])
|
call SendKeyGroup(mod_keycodes + [kcode])
|
||||||
let chstr_mswin = getcharstr(0)
|
let chstr_mswin = Getcharstr()
|
||||||
let chstr_mswin_end = chstr_mswin[len(chstr_mswin)-2:len(chstr_mswin)-1]
|
let chstr_mswin_end = chstr_mswin[len(chstr_mswin)-2:len(chstr_mswin)-1]
|
||||||
let mod_mask = getcharmod()
|
let mod_mask = getcharmod()
|
||||||
|
|
||||||
@ -653,7 +664,7 @@ func Test_QWERTY_Ctrl_minus()
|
|||||||
new
|
new
|
||||||
|
|
||||||
call SendKeyGroup([s:VK.CONTROL, s:VK.OEM_MINUS])
|
call SendKeyGroup([s:VK.CONTROL, s:VK.OEM_MINUS])
|
||||||
let ch = getcharstr(0)
|
let ch = Getcharstr()
|
||||||
call assert_equal(nr2char(0x1f),ch)
|
call assert_equal(nr2char(0x1f),ch)
|
||||||
|
|
||||||
call SendKey(s:VK.KEY_I)
|
call SendKey(s:VK.KEY_I)
|
||||||
|
@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
51,
|
||||||
/**/
|
/**/
|
||||||
50,
|
50,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user