annotate src/testdir/test_mswin_event.vim @ 31674:edbadc330871 v9.0.1169

patch 9.0.1169: some key+modifier tests fail on some AppVeyor images Commit: https://github.com/vim/vim/commit/566f76e6566ccc418b25d51f454d2cc509ca7f8a Author: Christopher Plewright <chris@createng.com> Date: Tue Jan 10 13:43:04 2023 +0000 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images Problem: Some key+modifier tests fail on some AppVeyor images. Solution: Adjust the tests for key movements and fix the revealed bugs. (Christopher Plewright, closes #11798)
author Bram Moolenaar <Bram@vim.org>
date Tue, 10 Jan 2023 14:45:07 +0100
parents 238f424acc6c
children dbec60b8c253
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
1 " Test MS-Windows input event handling.
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
2 " Most of this works the same in Windows GUI as well as Windows console.
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source check.vim
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 CheckMSWindows
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 source mouse.vim
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
8 " Helper function for sending a grouped sequence of low level key presses
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
9 " The modifer key(s) can be included as VK Key Codes in the sequence
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
10 " Keydown events will be sent, to to the end of the group, then keyup events
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
11 " will be sent in reverse order to release the keys.
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
12 func SendKeyGroup(keygroup)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
13 for k in a:keygroup
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
14 call test_mswin_event("key", {'event': "keydown", 'keycode': k})
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 endfor
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
16 for k in reverse(copy(a:keygroup))
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
17 call test_mswin_event("key", {'event': "keyup", 'keycode': k})
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
21 " Send individual key press and release events.
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 " the modifers for the key press can be specified in the modifiers arg.
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
23 func SendKeyWithModifiers(key, modifiers)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 let args = { }
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let args.keycode = a:key
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 let args.modifiers = a:modifiers
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 let args.event = "keydown"
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 call test_mswin_event("key", args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 let args.event = "keyup"
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 call test_mswin_event("key", args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 unlet args
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
34 " Send an individual key press, without modifiers.
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
35 func SendKey(key)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
36 call SendKeyWithModifiers(a:key, 0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
37 endfunc
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
38
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
39 " Send a string of individual key-press events, without modifiers.
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
40 func SendKeyStr(keystring)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
41 for k in a:keystring
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
42 call SendKey(k)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
43 endfor
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
44 endfunc
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
45
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
46 " This tells Vim to execute the buffered keys as user commands,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
47 " ie. same as feekdeys with mode X would do.
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
48 func ExecuteBufferedKeys()
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
49 if has('gui_running')
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
50 call feedkeys("\<Esc>", 'Lx!')
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
51 else
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
52 call test_mswin_event("key", {'execute': v:true})
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
53 endif
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
54 endfunc
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
55
31628
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
56 " Refer to the following page for the virtual key codes:
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
57 " https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
58 let s:VK = {
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
59 \ 'ENTER' : 0x0D,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
60 \ 'SPACE' : 0x20,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
61 \ 'SHIFT' : 0x10,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
62 \ 'LSHIFT' : 0xA0,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
63 \ 'RSHIFT' : 0xA1,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
64 \ 'CONTROL' : 0x11,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
65 \ 'LCONTROL' : 0xA2,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
66 \ 'RCONTROL' : 0xA3,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
67 \ 'MENU' : 0x12,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
68 \ 'ALT' : 0x12,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
69 \ 'LMENU' : 0xA4,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
70 \ 'LALT' : 0xA4,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
71 \ 'RMENU' : 0xA5,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
72 \ 'RALT' : 0xA5,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
73 \ 'OEM_1' : 0xBA,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
74 \ 'OEM_2' : 0xBF,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
75 \ 'OEM_3' : 0xC0,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
76 \ 'OEM_4' : 0xDB,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
77 \ 'OEM_5' : 0xDC,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
78 \ 'OEM_6' : 0xDD,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
79 \ 'OEM_7' : 0xDE,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
80 \ 'OEM_PLUS' : 0xBB,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
81 \ 'OEM_COMMA' : 0xBC,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
82 \ 'OEM_MINUS' : 0xBD,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
83 \ 'OEM_PERIOD' : 0xBE,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
84 \ 'PRIOR' : 0x21,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
85 \ 'NEXT' : 0x22,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
86 \ 'END' : 0x23,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
87 \ 'HOME' : 0x24,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
88 \ 'LEFT' : 0x25,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
89 \ 'UP' : 0x26,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
90 \ 'RIGHT' : 0x27,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
91 \ 'DOWN' : 0x28,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
92 \ 'KEY_0' : 0x30,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
93 \ 'KEY_1' : 0x31,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
94 \ 'KEY_2' : 0x32,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
95 \ 'KEY_3' : 0x33,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
96 \ 'KEY_4' : 0x34,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
97 \ 'KEY_5' : 0x35,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
98 \ 'KEY_6' : 0x36,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
99 \ 'KEY_7' : 0x37,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
100 \ 'KEY_8' : 0x38,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
101 \ 'KEY_9' : 0x39,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
102 \ 'KEY_A' : 0x41,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
103 \ 'KEY_B' : 0x42,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
104 \ 'KEY_C' : 0x43,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
105 \ 'KEY_D' : 0x44,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
106 \ 'KEY_E' : 0x45,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
107 \ 'KEY_F' : 0x46,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
108 \ 'KEY_G' : 0x47,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
109 \ 'KEY_H' : 0x48,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
110 \ 'KEY_I' : 0x49,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
111 \ 'KEY_J' : 0x4A,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
112 \ 'KEY_K' : 0x4B,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
113 \ 'KEY_L' : 0x4C,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
114 \ 'KEY_M' : 0x4D,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
115 \ 'KEY_N' : 0x4E,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
116 \ 'KEY_O' : 0x4F,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
117 \ 'KEY_P' : 0x50,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
118 \ 'KEY_Q' : 0x51,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
119 \ 'KEY_R' : 0x52,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
120 \ 'KEY_S' : 0x53,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
121 \ 'KEY_T' : 0x54,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
122 \ 'KEY_U' : 0x55,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
123 \ 'KEY_V' : 0x56,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
124 \ 'KEY_W' : 0x57,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
125 \ 'KEY_X' : 0x58,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
126 \ 'KEY_Y' : 0x59,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
127 \ 'KEY_Z' : 0x5A,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
128 \ 'NUMPAD0' : 0x60,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
129 \ 'NUMPAD1' : 0x61,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
130 \ 'NUMPAD2' : 0x62,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
131 \ 'NUMPAD3' : 0x63,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
132 \ 'NUMPAD4' : 0x64,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
133 \ 'NUMPAD5' : 0x65,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
134 \ 'NUMPAD6' : 0x66,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
135 \ 'NUMPAD7' : 0x67,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
136 \ 'NUMPAD8' : 0x68,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
137 \ 'NUMPAD9' : 0x69,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
138 \ 'MULTIPLY' : 0x6A,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
139 \ 'ADD' : 0x6B,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
140 \ 'SUBTRACT' : 0x6D,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
141 \ 'F1' : 0x70,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
142 \ 'F2' : 0x71,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
143 \ 'F3' : 0x72,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
144 \ 'F4' : 0x73,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
145 \ 'F5' : 0x74,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
146 \ 'F6' : 0x75,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
147 \ 'F7' : 0x76,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
148 \ 'F8' : 0x77,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
149 \ 'F9' : 0x78,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
150 \ 'F10' : 0x79,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
151 \ 'F11' : 0x7A,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
152 \ 'F12' : 0x7B,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
153 \ 'DELETE' : 0x2E,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
154 \ 'BACK' : 0x08,
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
155 \ 'ESCAPE' : 0x1B
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
156 \ }
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
157
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
158 let s:MOD_MASK_SHIFT = 0x02
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
159 let s:MOD_MASK_CTRL = 0x04
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
160 let s:MOD_MASK_ALT = 0x08
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
161
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
162 let s:vim_key_modifiers = [
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
163 \ ["", 0, []],
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
164 \ ["S-", 2, [s:VK.LSHIFT]],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
165 \ ["C-", 4, [s:VK.LCONTROL]],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
166 \ ["C-S-", 6, [s:VK.LCONTROL, s:VK.LSHIFT]],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
167 \ ["A-", 8, [s:VK.LMENU]],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
168 \ ["A-S-", 10, [s:VK.LMENU, s:VK.LSHIFT]],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
169 \ ["A-C-", 12, [s:VK.LMENU, s:VK.LCONTROL]],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
170 \ ["A-C-S-", 14, [s:VK.LMENU, s:VK.LCONTROL, s:VK.LSHIFT]],
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
171 \]
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
173 " Assuming Standard US PC Keyboard layout
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
174 let s:test_ascii_key_chars = [
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
175 \ [[s:VK.SPACE], ' '],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
176 \ [[s:VK.OEM_1], ';'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
177 \ [[s:VK.OEM_2], '/'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
178 \ [[s:VK.OEM_3], '`'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
179 \ [[s:VK.OEM_4], '['],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
180 \ [[s:VK.OEM_5], '\'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
181 \ [[s:VK.OEM_6], ']'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
182 \ [[s:VK.OEM_7], ''''],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
183 \ [[s:VK.OEM_PLUS], '='],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
184 \ [[s:VK.OEM_COMMA], ','],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
185 \ [[s:VK.OEM_MINUS], '-'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
186 \ [[s:VK.OEM_PERIOD], '.'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
187 \ [[s:VK.SHIFT, s:VK.OEM_1], ':'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
188 \ [[s:VK.SHIFT, s:VK.OEM_2], '?'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
189 \ [[s:VK.SHIFT, s:VK.OEM_3], '~'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
190 \ [[s:VK.SHIFT, s:VK.OEM_4], '{'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
191 \ [[s:VK.SHIFT, s:VK.OEM_5], '|'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
192 \ [[s:VK.SHIFT, s:VK.OEM_6], '}'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
193 \ [[s:VK.SHIFT, s:VK.OEM_7], '"'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
194 \ [[s:VK.SHIFT, s:VK.OEM_PLUS], '+'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
195 \ [[s:VK.SHIFT, s:VK.OEM_COMMA], '<'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
196 \ [[s:VK.SHIFT, s:VK.OEM_MINUS], '_'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
197 \ [[s:VK.SHIFT, s:VK.OEM_PERIOD], '>'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
198 \ [[s:VK.KEY_1], '1'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
199 \ [[s:VK.KEY_2], '2'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
200 \ [[s:VK.KEY_3], '3'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
201 \ [[s:VK.KEY_4], '4'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
202 \ [[s:VK.KEY_5], '5'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
203 \ [[s:VK.KEY_6], '6'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
204 \ [[s:VK.KEY_7], '7'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
205 \ [[s:VK.KEY_8], '8'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
206 \ [[s:VK.KEY_9], '9'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
207 \ [[s:VK.KEY_0], '0'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
208 \ [[s:VK.SHIFT, s:VK.KEY_1], '!'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
209 \ [[s:VK.SHIFT, s:VK.KEY_2], '@'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
210 \ [[s:VK.SHIFT, s:VK.KEY_3], '#'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
211 \ [[s:VK.SHIFT, s:VK.KEY_4], '$'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
212 \ [[s:VK.SHIFT, s:VK.KEY_5], '%'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
213 \ [[s:VK.SHIFT, s:VK.KEY_6], '^'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
214 \ [[s:VK.SHIFT, s:VK.KEY_7], '&'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
215 \ [[s:VK.SHIFT, s:VK.KEY_8], '*'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
216 \ [[s:VK.SHIFT, s:VK.KEY_9], '('],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
217 \ [[s:VK.SHIFT, s:VK.KEY_0], ')'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
218 \ [[s:VK.KEY_A], 'a'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
219 \ [[s:VK.KEY_B], 'b'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
220 \ [[s:VK.KEY_C], 'c'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
221 \ [[s:VK.KEY_D], 'd'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
222 \ [[s:VK.KEY_E], 'e'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
223 \ [[s:VK.KEY_F], 'f'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
224 \ [[s:VK.KEY_G], 'g'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
225 \ [[s:VK.KEY_H], 'h'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
226 \ [[s:VK.KEY_I], 'i'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
227 \ [[s:VK.KEY_J], 'j'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
228 \ [[s:VK.KEY_K], 'k'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
229 \ [[s:VK.KEY_L], 'l'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
230 \ [[s:VK.KEY_M], 'm'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
231 \ [[s:VK.KEY_N], 'n'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
232 \ [[s:VK.KEY_O], 'o'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
233 \ [[s:VK.KEY_P], 'p'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
234 \ [[s:VK.KEY_Q], 'q'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
235 \ [[s:VK.KEY_R], 'r'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
236 \ [[s:VK.KEY_S], 's'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
237 \ [[s:VK.KEY_T], 't'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
238 \ [[s:VK.KEY_U], 'u'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
239 \ [[s:VK.KEY_V], 'v'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
240 \ [[s:VK.KEY_W], 'w'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
241 \ [[s:VK.KEY_X], 'x'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
242 \ [[s:VK.KEY_Y], 'y'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
243 \ [[s:VK.KEY_Z], 'z'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
244 \ [[s:VK.SHIFT, s:VK.KEY_A], 'A'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
245 \ [[s:VK.SHIFT, s:VK.KEY_B], 'B'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
246 \ [[s:VK.SHIFT, s:VK.KEY_C], 'C'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
247 \ [[s:VK.SHIFT, s:VK.KEY_D], 'D'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
248 \ [[s:VK.SHIFT, s:VK.KEY_E], 'E'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
249 \ [[s:VK.SHIFT, s:VK.KEY_F], 'F'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
250 \ [[s:VK.SHIFT, s:VK.KEY_G], 'G'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
251 \ [[s:VK.SHIFT, s:VK.KEY_H], 'H'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
252 \ [[s:VK.SHIFT, s:VK.KEY_I], 'I'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
253 \ [[s:VK.SHIFT, s:VK.KEY_J], 'J'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
254 \ [[s:VK.SHIFT, s:VK.KEY_K], 'K'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
255 \ [[s:VK.SHIFT, s:VK.KEY_L], 'L'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
256 \ [[s:VK.SHIFT, s:VK.KEY_M], 'M'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
257 \ [[s:VK.SHIFT, s:VK.KEY_N], 'N'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
258 \ [[s:VK.SHIFT, s:VK.KEY_O], 'O'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
259 \ [[s:VK.SHIFT, s:VK.KEY_P], 'P'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
260 \ [[s:VK.SHIFT, s:VK.KEY_Q], 'Q'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
261 \ [[s:VK.SHIFT, s:VK.KEY_R], 'R'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
262 \ [[s:VK.SHIFT, s:VK.KEY_S], 'S'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
263 \ [[s:VK.SHIFT, s:VK.KEY_T], 'T'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
264 \ [[s:VK.SHIFT, s:VK.KEY_U], 'U'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
265 \ [[s:VK.SHIFT, s:VK.KEY_V], 'V'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
266 \ [[s:VK.SHIFT, s:VK.KEY_W], 'W'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
267 \ [[s:VK.SHIFT, s:VK.KEY_X], 'X'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
268 \ [[s:VK.SHIFT, s:VK.KEY_Y], 'Y'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
269 \ [[s:VK.SHIFT, s:VK.KEY_Z], 'Z'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
270 \ [[s:VK.CONTROL, s:VK.KEY_A], 0x01],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
271 \ [[s:VK.CONTROL, s:VK.KEY_B], 0x02],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
272 \ [[s:VK.CONTROL, s:VK.KEY_C], 0x03],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
273 \ [[s:VK.CONTROL, s:VK.KEY_D], 0x04],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
274 \ [[s:VK.CONTROL, s:VK.KEY_E], 0x05],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
275 \ [[s:VK.CONTROL, s:VK.KEY_F], 0x06],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
276 \ [[s:VK.CONTROL, s:VK.KEY_G], 0x07],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
277 \ [[s:VK.CONTROL, s:VK.KEY_H], 0x08],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
278 \ [[s:VK.CONTROL, s:VK.KEY_I], 0x09],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
279 \ [[s:VK.CONTROL, s:VK.KEY_J], 0x0A],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
280 \ [[s:VK.CONTROL, s:VK.KEY_K], 0x0B],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
281 \ [[s:VK.CONTROL, s:VK.KEY_L], 0x0C],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
282 \ [[s:VK.CONTROL, s:VK.KEY_M], 0x0D],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
283 \ [[s:VK.CONTROL, s:VK.KEY_N], 0x0E],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
284 \ [[s:VK.CONTROL, s:VK.KEY_O], 0x0F],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
285 \ [[s:VK.CONTROL, s:VK.KEY_P], 0x10],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
286 \ [[s:VK.CONTROL, s:VK.KEY_Q], 0x11],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
287 \ [[s:VK.CONTROL, s:VK.KEY_R], 0x12],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
288 \ [[s:VK.CONTROL, s:VK.KEY_S], 0x13],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
289 \ [[s:VK.CONTROL, s:VK.KEY_T], 0x14],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
290 \ [[s:VK.CONTROL, s:VK.KEY_U], 0x15],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
291 \ [[s:VK.CONTROL, s:VK.KEY_V], 0x16],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
292 \ [[s:VK.CONTROL, s:VK.KEY_W], 0x17],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
293 \ [[s:VK.CONTROL, s:VK.KEY_X], 0x18],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
294 \ [[s:VK.CONTROL, s:VK.KEY_Y], 0x19],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
295 \ [[s:VK.CONTROL, s:VK.KEY_Z], 0x1A],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
296 \ [[s:VK.CONTROL, s:VK.OEM_4], 0x1B],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
297 \ [[s:VK.CONTROL, s:VK.OEM_5], 0x1C],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
298 \ [[s:VK.CONTROL, s:VK.OEM_6], 0x1D],
31628
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
299 \ [[s:VK.CONTROL, s:VK.KEY_6], 0x1E],
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
300 \ [[s:VK.CONTROL, s:VK.OEM_MINUS], 0x1F],
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
301 \ ]
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
302
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
303 let s:test_extra_key_chars = [
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
304 \ [[s:VK.ALT, s:VK.KEY_1], '±'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
305 \ [[s:VK.ALT, s:VK.KEY_2], '²'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
306 \ [[s:VK.ALT, s:VK.KEY_3], '³'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
307 \ [[s:VK.ALT, s:VK.KEY_4], '´'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
308 \ [[s:VK.ALT, s:VK.KEY_5], 'µ'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
309 \ [[s:VK.ALT, s:VK.KEY_6], '¶'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
310 \ [[s:VK.ALT, s:VK.KEY_7], '·'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
311 \ [[s:VK.ALT, s:VK.KEY_8], '¸'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
312 \ [[s:VK.ALT, s:VK.KEY_9], '¹'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
313 \ [[s:VK.ALT, s:VK.KEY_0], '°'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
314 \ [[s:VK.ALT, s:VK.KEY_A], 'á'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
315 \ [[s:VK.ALT, s:VK.KEY_B], 'â'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
316 \ [[s:VK.ALT, s:VK.KEY_C], 'ã'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
317 \ [[s:VK.ALT, s:VK.KEY_D], 'ä'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
318 \ [[s:VK.ALT, s:VK.KEY_E], 'Ã¥'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
319 \ [[s:VK.ALT, s:VK.KEY_F], 'æ'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
320 \ [[s:VK.ALT, s:VK.KEY_G], 'ç'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
321 \ [[s:VK.ALT, s:VK.KEY_H], 'è'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
322 \ [[s:VK.ALT, s:VK.KEY_I], 'é'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
323 \ [[s:VK.ALT, s:VK.KEY_J], 'ê'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
324 \ [[s:VK.ALT, s:VK.KEY_K], 'ë'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
325 \ [[s:VK.ALT, s:VK.KEY_L], 'ì'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
326 \ [[s:VK.ALT, s:VK.KEY_M], 'í'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
327 \ [[s:VK.ALT, s:VK.KEY_N], 'î'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
328 \ [[s:VK.ALT, s:VK.KEY_O], 'ï'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
329 \ [[s:VK.ALT, s:VK.KEY_P], 'ð'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
330 \ [[s:VK.ALT, s:VK.KEY_Q], 'ñ'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
331 \ [[s:VK.ALT, s:VK.KEY_R], 'ò'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
332 \ [[s:VK.ALT, s:VK.KEY_S], 'ó'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
333 \ [[s:VK.ALT, s:VK.KEY_T], 'ô'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
334 \ [[s:VK.ALT, s:VK.KEY_U], 'õ'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
335 \ [[s:VK.ALT, s:VK.KEY_V], 'ö'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
336 \ [[s:VK.ALT, s:VK.KEY_W], '÷'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
337 \ [[s:VK.ALT, s:VK.KEY_X], 'ø'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
338 \ [[s:VK.ALT, s:VK.KEY_Y], 'ù'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
339 \ [[s:VK.ALT, s:VK.KEY_Z], 'ú'],
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
340 \ ]
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
341
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
342 func s:LoopTestKeyArray(arr)
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
343 " flush out the typeahead buffer
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 while getchar(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 endwhile
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
347 for [kcodes, kstr] in a:arr
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
348 " Send as a sequence of key presses.
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
349 call SendKeyGroup(kcodes)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 let ch = getcharstr(0)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
351 " need to deal a bit differently with the non-printable ascii chars < 0x20
31628
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
352 if kstr < 0x20 && index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], kcodes[0]) >= 0
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
353 call assert_equal(nr2char(kstr), $"{ch}")
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
354 else
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
355 call assert_equal(kstr, $"{ch}")
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
356 endif
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 let mod_mask = getcharmod()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 " the mod_mask is zero when no modifiers are used
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
359 " and when the virtual termcap maps the character
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 call assert_equal(0, mod_mask, $"key = {kstr}")
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
362 " Send as a single key press with a modifers mask.
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 let modifiers = 0
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 let key = kcodes[0]
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 for key in kcodes
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
366 if index([s:VK.SHIFT, s:VK.LSHIFT, s:VK.RSHIFT], key) >= 0
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
367 let modifiers = modifiers + s:MOD_MASK_SHIFT
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 endif
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
369 if index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], key) >= 0
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
370 let modifiers = modifiers + s:MOD_MASK_CTRL
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 endif
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
372 if index([s:VK.ALT, s:VK.LALT, s:VK.RALT], key) >= 0
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
373 let modifiers = modifiers + s:MOD_MASK_ALT
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 endfor
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
376 call SendKeyWithModifiers(key, modifiers)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377 let ch = getcharstr(0)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
378 " need to deal a bit differently with the non-printable ascii chars < 0x20
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
379 if kstr < 0x20 && index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], kcodes[0]) >= 0
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
380 call assert_equal(nr2char(kstr), $"{ch}")
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
381 else
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
382 call assert_equal(kstr, $"{ch}")
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
383 endif
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384 let mod_mask = getcharmod()
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
385 " the mod_mask is zero when no modifiers are used
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
386 " and when the virtual termcap maps the character
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
387 call assert_equal(0, mod_mask, $"key = {kstr}")
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
390 " flush out the typeahead buffer
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
391 while getchar(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 endwhile
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
393
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
394 endfunc
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
395
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
396 " Test MS-Windows key events
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
397 func Test_mswin_event_character_keys()
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
398 CheckMSWindows
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
399 new
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
400
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
401 call s:LoopTestKeyArray(s:test_ascii_key_chars)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
402
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
403 if !has('gui_running')
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
404 call s:LoopTestKeyArray(s:test_extra_key_chars)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
405 endif
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
406
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
407 " Test keyboard codes for digits
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
408 " (0x30 - 0x39) : VK_0 - VK_9 are the same as ASCII '0' - '9'
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409 for kc in range(48, 57)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
410 call SendKey(kc)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
411 let ch = getcharstr(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412 call assert_equal(nr2char(kc), ch)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
413 call SendKeyWithModifiers(kc, 0)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 let ch = getcharstr(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 call assert_equal(nr2char(kc), ch)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 " Test keyboard codes for Alt-0 to Alt-9
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419 " Expect +128 from the digit char codes
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
420 for modkey in [s:VK.ALT, s:VK.LALT, s:VK.RALT]
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 for kc in range(48, 57)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
422 call SendKeyGroup([modkey, kc])
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423 let ch = getchar(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 call assert_equal(kc+128, ch)
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
425 call SendKeyWithModifiers(kc, s:MOD_MASK_ALT)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426 let ch = getchar(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427 call assert_equal(kc+128, ch)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 " Test for lowercase 'a' to 'z', VK codes 65(0x41) - 90(0x5A)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 " Note: VK_A-VK_Z virtual key codes coincide with uppercase ASCII codes A-Z.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 " eg VK_A is 65, and the ASCII character code for uppercase 'A' is also 65.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434 " Caution: these are interpreted as lowercase when Shift is NOT pressed.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 " eg, sending VK_A (65) 'A' Key code without shift modifier, will produce ASCII
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 " char 'a' (91) as the output. The ASCII codes for the lowercase letters are
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 " numbered 32 higher than their uppercase versions.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 for kc in range(65, 90)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
439 call SendKey(kc)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 let ch = getcharstr(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 call assert_equal(nr2char(kc + 32), ch)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
442 call SendKeyWithModifiers(kc, 0)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 let ch = getcharstr(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 call assert_equal(nr2char(kc + 32), ch)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447 " Test for Uppercase 'A' - 'Z' keys
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 " ie. with VK_SHIFT, expect the keycode = character code.
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
449 for modkey in [s:VK.SHIFT, s:VK.LSHIFT, s:VK.RSHIFT]
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
450 for kc in range(65, 90)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
451 call SendKeyGroup([modkey, kc])
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
452 let ch = getcharstr(0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
453 call assert_equal(nr2char(kc), ch)
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
454 call SendKeyWithModifiers(kc, s:MOD_MASK_SHIFT)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
455 let ch = getcharstr(0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
456 call assert_equal(nr2char(kc), ch)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
457 endfor
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460 " Test for <Ctrl-A> to <Ctrl-Z> keys
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 " Expect the unicode characters 0x01 to 0x1A
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
462 for modkey in [s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL]
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 for kc in range(65, 90)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
464 call SendKeyGroup([modkey, kc])
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 let ch = getcharstr(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 call assert_equal(nr2char(kc - 64), ch)
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
467 call SendKeyWithModifiers(kc, s:MOD_MASK_CTRL)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 let ch = getcharstr(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 call assert_equal(nr2char(kc - 64), ch)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
473 " Windows intercepts some of these keys in the GUI.
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 if !has("gui_running")
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
475 " Test for <Alt-A> to <Alt-Z> keys
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 " Expect the unicode characters 0xE1 to 0xFA
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 " ie. 160 higher than the lowercase equivalent
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
478 for modkey in [s:VK.ALT, s:VK.LALT, s:VK.RALT]
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
479 for kc in range(65, 90)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
480 call SendKeyGroup([modkey, kc])
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
481 let ch = getchar(0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
482 call assert_equal(kc+160, ch)
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
483 call SendKeyWithModifiers(kc, s:MOD_MASK_ALT)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
484 let ch = getchar(0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
485 call assert_equal(kc+160, ch)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
486 endfor
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
490 endfun
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
491
31628
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
492 " Test for Function Keys 'F1' to 'F12'
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
493 " VK codes 112(0x70) - 123(0x7B)
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
494 " Also with ALL permutatios of modifiers; Shift, Ctrl & Alt
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
495 func Test_mswin_event_function_keys()
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
496
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
497 if has('gui_running')
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
498 let g:test_is_flaky = 1
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
499 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
500
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
501 " NOTE: Windows intercepts these combinations in the GUI
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
502 let gui_nogo = ["A-F1", "A-F2", "A-F3", "A-F4", "A-S-F4", "A-C-S-F4",
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
503 \ "A-F5", "A-F6", "A-F7", "A-F8", "A-C-F8", "A-F9",
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
504 \ "A-F10", "A-F11" , "A-C-F11", "A-C-F12"]
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
505
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
506 " flush out the typeahead buffer
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
507 while getchar(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
508 endwhile
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
509
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
510 for [mod_str, vim_mod_mask, mod_keycodes] in s:vim_key_modifiers
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
511 for n in range(1, 12)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
512 let expected_mod_mask = vim_mod_mask
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
513 let kstr = $"{mod_str}F{n}"
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
514 if !has('gui_running') || (has('gui_running') && n != 10
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
515 \ && index(gui_nogo, kstr) == -1)
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
516 let keycode = eval('"\<' .. kstr .. '>"')
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
517 " flush out the typeahead buffer
31628
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
518 while getchar(0)
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
519 endwhile
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
520 call SendKeyWithModifiers(111+n, vim_mod_mask)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
521 let ch = getcharstr(0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
522 let mod_mask = getcharmod()
31628
238f424acc6c patch 9.0.1146: MS-Windows: various special keys/modifiers are not mappable
Bram Moolenaar <Bram@vim.org>
parents: 31559
diff changeset
523 call assert_equal(keycode, $"{ch}", $"key = {kstr}")
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
524 " workaround for the virtual termcap maps changing the character
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
525 "instead of sending Shift
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
526 for mod_key in mod_keycodes
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
527 if index([s:VK.SHIFT, s:VK.LSHIFT, s:VK.RSHIFT], mod_key) >= 0
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
528 let expected_mod_mask -= s:MOD_MASK_SHIFT
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
529 break
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
530 endif
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
531 endfor
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
532 call assert_equal(expected_mod_mask, mod_mask, $"mod = {expected_mod_mask} for key = {kstr}")
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
533 endif
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
534 endfor
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
535 endfor
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
536 endfunc
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
537
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
538 func ExtractModifiers(mod_keycodes)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
539 let has_shift = 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
540 let has_ctrl = 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
541 let has_alt = 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
542 for mod_key in a:mod_keycodes
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
543 if index([s:VK.SHIFT, s:VK.LSHIFT, s:VK.RSHIFT], mod_key) >= 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
544 let has_shift = 1
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
545 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
546 if index([s:VK.CONTROL, s:VK.LCONTROL, s:VK.RCONTROL], mod_key) >= 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
547 let has_ctrl = 1
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
548 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
549 if index([s:VK.MENU, s:VK.LMENU, s:VK.RMENU], mod_key) >= 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
550 let has_alt = 1
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
551 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
552 endfor
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
553 return [has_shift, has_ctrl, has_alt]
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
554 endfunc
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
555
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
556 " Test for Movement Keys;
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
557 " VK_PRIOR 0x21, VK_NEXT 0x22,
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
558 " VK_END 0x23, VK_HOME 0x24,
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
559 " VK_LEFT 0x25, VK_UP 0x26,
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
560 " VK_RIGHT 0x27, VK_DOWN 0x28
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
561 " With ALL permutations of modifiers; none, Shift, Ctrl & Alt
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
562 func Test_mswin_event_movement_keys()
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
563
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
564 if has('gui_running')
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
565 let g:test_is_flaky = 1
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
568 let movement_keys = [
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
569 \ [s:VK.PRIOR, "PageUp"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
570 \ [s:VK.NEXT, "PageDown"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
571 \ [s:VK.END, "End"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
572 \ [s:VK.HOME, "Home"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
573 \ [s:VK.LEFT, "Left"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
574 \ [s:VK.UP, "Up"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
575 \ [s:VK.RIGHT, "Right"],
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
576 \ [s:VK.DOWN, "Down"],
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
577 \ ]
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
578
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
579 " flush out the typeahead buffer
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
580 while getchar(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
581 endwhile
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
582
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
583 for [mod_str, vim_mod_mask, mod_keycodes] in s:vim_key_modifiers
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
584 for [kcode, kname] in movement_keys
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
585 let exp_mod_mask = vim_mod_mask
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
586 let kstr = $"{mod_str}{kname}"
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
587 let chstr_eval = eval('"\<' .. kstr .. '>"')
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
588
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
589 " flush out the typeahead buffer
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
590 while getchar(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
591 endwhile
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
592 execute 'call feedkeys("\<' .. kstr .. '>")'
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
593 let chstr_fk = getcharstr(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
594 call assert_equal(chstr_eval, chstr_fk, $"feedkeys = <{kstr}>")
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
595
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
596 " flush out the typeahead buffer
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
597 while getchar(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
598 endwhile
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
599 call SendKey(kcode)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
600 let chstr_alone = getcharstr(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
601 let chstr_alone_end = chstr_alone[len(chstr_alone)-2:len(chstr_alone)-1]
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
602
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
603 " flush out the typeahead buffer
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
604 while getchar(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
605 endwhile
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
606 call SendKeyGroup(mod_keycodes + [kcode])
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
607 let chstr_mswin = getcharstr(0)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
608 let chstr_mswin_end = chstr_mswin[len(chstr_mswin)-2:len(chstr_mswin)-1]
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
609 let mod_mask = getcharmod()
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
610
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
611 " The virtual termcap maps may** change the character and either;
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
612 " - remove the Shift modifier, or
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
613 " - remove the Ctrl modifier if the Shift modifier was not removed.
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
614 let [has_shift, has_ctrl, has_alt] = ExtractModifiers(mod_keycodes)
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
615 if chstr_alone_end != chstr_mswin_end
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
616 if has_shift != 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
617 let exp_mod_mask -= s:MOD_MASK_SHIFT
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
618 elseif has_ctrl != 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
619 let exp_mod_mask -= s:MOD_MASK_CTRL
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
620 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
621 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
622 " **Note: The appveyor Windows GUI test environments, from VS2017 on,
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
623 " consistently intercepts the Shift modifier WITHOUT changing the
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
624 " MOVEMENT character. This issue does not happen in any github actions
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
625 " CI Windows test environments. Attempted to reproduce this manually
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
626 " on Windows versions; 7, 8.1, 10, 11, Server 2019 and Server 2022, but
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
627 " the issue did not occur on any of those environments.
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
628 " Below is a workaround for the issue.
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
629 if has('gui_running') && has_shift != 0
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
630 if exp_mod_mask != mod_mask && chstr_eval != chstr_mswin
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
631 let kstr_sub = substitute(kstr, "S-", "", "")
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
632 let chstr_eval = eval('"\<' .. kstr_sub .. '>"')
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
633 if exp_mod_mask - s:MOD_MASK_SHIFT == mod_mask
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
634 let exp_mod_mask -= s:MOD_MASK_SHIFT
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
635 elseif has_ctrl != 0 && exp_mod_mask - s:MOD_MASK_CTRL == mod_mask
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
636 let exp_mod_mask -= s:MOD_MASK_CTRL
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
637 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
638 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
639 endif
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
640 call assert_equal(chstr_eval, chstr_mswin, $"key = {kstr}")
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
641 call assert_equal(exp_mod_mask, mod_mask, $"mod_mask for key = {kstr}")
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
642 endfor
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
643 endfor
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
644
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
645 bw!
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647
31559
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
648
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
649 " Test for QWERTY Ctrl+- which should result in ^_
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
650 " issue #10817
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
651 func Test_QWERTY_Ctrl_minus()
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
652 CheckMSWindows
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
653 new
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
654
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
655 call SendKeyGroup([s:VK.CONTROL, s:VK.OEM_MINUS])
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
656 let ch = getcharstr(0)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
657 call assert_equal(nr2char(0x1f),ch)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
658
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
659 call SendKey(s:VK.KEY_I)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
660 call SendKeyGroup([s:VK.CONTROL, s:VK.SUBTRACT])
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
661 call SendKey(s:VK.ESCAPE)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
662 call ExecuteBufferedKeys()
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
663 call assert_equal('-', getline('$'))
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
664
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
665 %d _
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
666 imapclear
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
667 imap <C-_> BINGO
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
668 call SendKey(s:VK.KEY_I)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
669 call SendKeyGroup([s:VK.CONTROL, s:VK.OEM_MINUS])
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
670 call SendKey(s:VK.ESCAPE)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
671 call ExecuteBufferedKeys()
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
672 call assert_equal('BINGO', getline('$'))
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
673
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
674 %d _
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
675 imapclear
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
676 exec "imap \x1f BILBO"
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
677 call SendKey(s:VK.KEY_I)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
678 call SendKeyGroup([s:VK.CONTROL, s:VK.OEM_MINUS])
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
679 call SendKey(s:VK.ESCAPE)
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
680 call ExecuteBufferedKeys()
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
681 call assert_equal('BILBO', getline('$'))
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
682
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
683 imapclear
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
684 bw!
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
685 endfunc
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
686
a3dca61f3ba3 patch 9.0.1112: test_mswin_event() can hang
Bram Moolenaar <Bram@vim.org>
parents: 31503
diff changeset
687 " Test MS-Windows mouse events
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
688 func Test_mswin_event_mouse()
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
689 CheckMSWindows
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
690 new
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692 set mousemodel=extend
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693 call test_override('no_query_mouse', 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694 call WaitForResponses()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 let msg = ''
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
698 call setline(1, ['one two three', 'four five six'])
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
699
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
700 " Test mouse movement
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 " by default, no mouse move events are generated
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
702 " this setting enables it to generate move events
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 set mousemev
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
705 if !has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 " console version needs a button pressed,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
707 " otherwise it ignores mouse movements.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
708 call MouseLeftClick(2, 3)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
709 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
710 call MSWinMouseEvent(0x700, 8, 13, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
711 if has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
712 call feedkeys("\<Esc>", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
713 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
714 let pos = getmousepos()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
715 call assert_equal(8, pos.screenrow)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716 call assert_equal(13, pos.screencol)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
717
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
718 if !has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
719 call MouseLeftClick(2, 3)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
720 call MSWinMouseEvent(0x700, 6, 4, 1, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 let pos = getmousepos()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
722 call assert_equal(6, pos.screenrow)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
723 call assert_equal(4, pos.screencol)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
724 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
725
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
726 " test cells vs pixels
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727 if has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 let args = { }
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
729 let args.row = 9
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 let args.col = 7
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
731 let args.move = 1
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
732 let args.cell = 1
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
733 call test_mswin_event("mouse", args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
734 call feedkeys("\<Esc>", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
735 let pos = getmousepos()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736 call assert_equal(9, pos.screenrow)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
737 call assert_equal(7, pos.screencol)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
738
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
739 let args.cell = 0
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
740 call test_mswin_event("mouse", args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
741 call feedkeys("\<Esc>", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
742 let pos = getmousepos()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
743 call assert_equal(1, pos.screenrow)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
744 call assert_equal(1, pos.screencol)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
745
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
746 unlet args
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749 " finish testing mouse movement
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 set mousemev&
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
751
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752 " place the cursor using left click and release in normal mode
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
753 call MouseLeftClick(2, 4)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
754 call MouseLeftRelease(2, 4)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
755 if has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 call feedkeys("\<Esc>", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 call assert_equal([0, 2, 4, 0], getpos('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760 " select and yank a word
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 let @" = ''
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 call MouseLeftClick(1, 9)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 let args = #{button: 0, row: 1, col: 9, multiclick: 1, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
764 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 call MouseLeftRelease(1, 9)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
766 call feedkeys("y", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767 call assert_equal('three', @")
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 " create visual selection using right click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770 let @" = ''
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 call MouseLeftClick(2 ,6)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 call MouseLeftRelease(2, 6)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 call MouseRightClick(2, 13)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 call MouseRightRelease(2, 13)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 call feedkeys("y", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777 call assert_equal('five six', @")
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
778
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
779 " paste using middle mouse button
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
780 let @* = 'abc '
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
781 call feedkeys('""', 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
782 call MouseMiddleClick(1, 9)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
783 call MouseMiddleRelease(1, 9)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
784 if has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
785 call feedkeys("\<Esc>", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
786 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
787 call assert_equal(['one two abc three', 'four five six'], getline(1, '$'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
788
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
789 " test mouse scrolling (aka touchpad scrolling.)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
790 %d _
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
791 set scrolloff=0
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
792 call setline(1, range(1, 100))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
793
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
794 " Scroll Down
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
795 call MouseWheelDown(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
796 call MouseWheelDown(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
797 call MouseWheelDown(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
798 call feedkeys("H", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
799 call assert_equal(10, line('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
800
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
801 " Scroll Up
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
802 call MouseWheelUp(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
803 call MouseWheelUp(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
804 call feedkeys("H", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
805 call assert_equal(4, line('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
806
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
807 " Shift Scroll Down
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
808 call MouseShiftWheelDown(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
809 call feedkeys("H", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
810 " should scroll from where it is (4) + visible buffer height - cmdheight
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811 let shift_scroll_height = line('w$') - line('w0') - &cmdheight
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 call assert_equal(4 + shift_scroll_height, line('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814 " Shift Scroll Up
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815 call MouseShiftWheelUp(2, 1)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816 call feedkeys("H", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817 call assert_equal(4, line('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 if !has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
820 " Shift Scroll Down (using MOD)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 call MSWinMouseEvent(0x100, 2, 1, 0, 0, 0x04)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822 call feedkeys("H", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823 " should scroll from where it is (4) + visible buffer height - cmdheight
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824 let shift_scroll_height = line('w$') - line('w0') - &cmdheight
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825 call assert_equal(4 + shift_scroll_height, line('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 " Shift Scroll Up (using MOD)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 call MSWinMouseEvent(0x200, 2, 1, 0, 0, 0x04)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
829 call feedkeys("H", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
830 call assert_equal(4, line('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
831 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
832
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833 set scrolloff&
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 %d _
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
836 set nowrap
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 " make the buffer 500 wide.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838 call setline(1, range(10)->join('')->repeat(50))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 " Scroll Right
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840 call MouseWheelRight(1, 5)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 call MouseWheelRight(1, 10)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 call MouseWheelRight(1, 15)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
843 call feedkeys('g0', 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 call assert_equal(19, col('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
845
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846 " Scroll Left
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 call MouseWheelLeft(1, 15)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848 call MouseWheelLeft(1, 10)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 call feedkeys('g0', 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
850 call assert_equal(7, col('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
851
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
852 " Shift Scroll Right
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 call MouseShiftWheelRight(1, 10)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854 call feedkeys('g0', 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 " should scroll from where it is (7) + window width
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 call assert_equal(7 + winwidth(0), col('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 " Shift Scroll Left
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 call MouseShiftWheelLeft(1, 50)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 call feedkeys('g0', 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861 call assert_equal(7, col('.'))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 set wrap&
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
864 %d _
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
865 call setline(1, repeat([repeat('a', 60)], 10))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
866
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
867 " record various mouse events
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
868 let mouseEventNames = [
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
869 \ 'LeftMouse', 'LeftRelease', '2-LeftMouse', '3-LeftMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
870 \ 'S-LeftMouse', 'A-LeftMouse', 'C-LeftMouse', 'MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
871 \ 'MiddleRelease', '2-MiddleMouse', '3-MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
872 \ 'S-MiddleMouse', 'A-MiddleMouse', 'C-MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
873 \ 'RightMouse', 'RightRelease', '2-RightMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
874 \ '3-RightMouse', 'S-RightMouse', 'A-RightMouse', 'C-RightMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
875 \ ]
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
876 let mouseEventCodes = map(copy(mouseEventNames), "'<' .. v:val .. '>'")
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
877 let g:events = []
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
878 for e in mouseEventCodes
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
879 exe 'nnoremap ' .. e .. ' <Cmd>call add(g:events, "' ..
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
880 \ substitute(e, '[<>]', '', 'g') .. '")<CR>'
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
881 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
882
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
883 " Test various mouse buttons
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
884 "(0 - Left, 1 - Middle, 2 - Right,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
885 " 0x300 - MOUSE_X1/FROM_LEFT_3RD_BUTTON,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
886 " 0x400 - MOUSE_X2/FROM_LEFT_4TH_BUTTON)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
887 for button in [0, 1, 2, 0x300, 0x400]
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
888 " Single click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
889 let args = #{button: button, row: 2, col: 5, multiclick: 0, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
890 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
891 let args.button = 3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
892 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
893
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
894 " Double Click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
895 let args.button = button
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
896 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
897 let args.multiclick = 1
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
898 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
899 let args.button = 3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
900 let args.multiclick = 0
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
901 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
902
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
903 " Triple Click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
904 let args.button = button
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
905 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
906 let args.multiclick = 1
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
907 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
908 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
909 let args.button = 3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
910 let args.multiclick = 0
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
911 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
912
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
913 " Shift click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
914 let args = #{button: button, row: 3, col: 7, multiclick: 0, modifiers: 4}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
915 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
916 let args.button = 3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
917 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
918
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
919 " Alt click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
920 let args.button = button
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
921 let args.modifiers = 8
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
922 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
923 let args.button = 3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
924 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926 " Ctrl click
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
927 let args.button = button
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
928 let args.modifiers = 16
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
929 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
930 let args.button = 3
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
931 call test_mswin_event('mouse', args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
932
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
933 call feedkeys("\<Esc>", 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
934 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
935
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
936 if has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 call assert_equal(['LeftMouse', 'LeftRelease', 'LeftMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
938 \ '2-LeftMouse', 'LeftMouse', '2-LeftMouse', '3-LeftMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
939 \ 'S-LeftMouse', 'A-LeftMouse', 'C-LeftMouse', 'MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
940 \ 'MiddleRelease', 'MiddleMouse', '2-MiddleMouse', 'MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
941 \ '2-MiddleMouse', '3-MiddleMouse', 'S-MiddleMouse', 'A-MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
942 \ 'C-MiddleMouse', 'RightMouse', 'RightRelease', 'RightMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
943 \ '2-RightMouse', 'RightMouse', '2-RightMouse', '3-RightMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
944 \ 'S-RightMouse', 'A-RightMouse', 'C-RightMouse'],
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
945 \ g:events)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
946 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
947 call assert_equal(['MiddleRelease', 'LeftMouse', '2-LeftMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
948 \ '3-LeftMouse', 'S-LeftMouse', 'MiddleMouse', '2-MiddleMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
949 \ '3-MiddleMouse', 'MiddleMouse', 'S-MiddleMouse', 'RightMouse',
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
950 \ '2-RightMouse', '3-RightMouse'],
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
951 \ g:events)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
952 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
953
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
954 for e in mouseEventCodes
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
955 exe 'nunmap ' .. e
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
956 endfor
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
957
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
958 bw!
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
959 call test_override('no_query_mouse', 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
960 set mousemodel&
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
961 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
962
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
963
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
964 " Test MS-Windows test_mswin_event error handling
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
965 func Test_mswin_event_error_handling()
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
966
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
967 let args = #{button: 0xfff, row: 2, col: 4, move: 0, multiclick: 0, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
968 if !has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
969 call assert_fails("call test_mswin_event('mouse', args)",'E475:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
970 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
971 let args = #{button: 0, row: 2, col: 4, move: 0, multiclick: 0, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
972 call assert_fails("call test_mswin_event('a1b2c3', args)", 'E475:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
973 call assert_fails("call test_mswin_event(test_null_string(), {})", 'E475:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
974
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
975 call assert_fails("call test_mswin_event([], args)", 'E1174:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
976 call assert_fails("call test_mswin_event('abc', [])", 'E1206:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
977
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
978 call assert_false(test_mswin_event('mouse', test_null_dict()))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
979 let args = #{row: 2, col: 4, multiclick: 0, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
980 call assert_false(test_mswin_event('mouse', args))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
981 let args = #{button: 0, col: 4, multiclick: 0, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
982 call assert_false(test_mswin_event('mouse', args))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
983 let args = #{button: 0, row: 2, multiclick: 0, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
984 call assert_false(test_mswin_event('mouse', args))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
985 let args = #{button: 0, row: 2, col: 4, modifiers: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
986 call assert_false(test_mswin_event('mouse', args))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
987 let args = #{button: 0, row: 2, col: 4, multiclick: 0}
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
988 call assert_false(test_mswin_event('mouse', args))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
989
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
990 call assert_false(test_mswin_event('key', test_null_dict()))
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
991 call assert_fails("call test_mswin_event('key', [])", 'E1206:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
992 call assert_fails("call test_mswin_event('key', {'event': 'keydown', 'keycode': 0x0})", 'E1291:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
993 call assert_fails("call test_mswin_event('key', {'event': 'keydown', 'keycode': [15]})", 'E745:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
994 call assert_fails("call test_mswin_event('key', {'event': 'keys', 'keycode': 0x41})", 'E475:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
995 call assert_fails("call test_mswin_event('key', {'keycode': 0x41})", 'E417:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
996 call assert_fails("call test_mswin_event('key', {'event': 'keydown'})", 'E1291:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
997
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
998 call assert_fails("sandbox call test_mswin_event('key', {'event': 'keydown', 'keycode': 61 })", 'E48:')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
999
31674
edbadc330871 patch 9.0.1169: some key+modifier tests fail on some AppVeyor images
Bram Moolenaar <Bram@vim.org>
parents: 31628
diff changeset
1000 " flush out the typeahead buffer
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1001 while getchar(0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1002 endwhile
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1003 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1004
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1005
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006 " vim: shiftwidth=2 sts=2 expandtab