annotate src/testdir/test_termcodes.vim @ 18717:14d2a210fab1 v8.1.2350

patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys Commit: https://github.com/vim/vim/commit/fc4ea2a72d36de1196a3ce17352e72f8fe90f4bb Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 26 19:33:22 2019 +0100 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys Problem: Other text for CTRL-V in Insert mode with modifyOtherKeys. Solution: Convert the Escape sequence back to key as if modifyOtherKeys is not set, and use CTRL-SHIFT-V to get the Escape sequence itself. (closes #5254)
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 Nov 2019 19:45:04 +0100
parents ac08c7ad9d37
children 5c256866b837
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16263
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for decoding escape sequences sent by the terminal.
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " This only works for Unix in a terminal
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
4 source check.vim
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
5 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
6 CheckUnix
16263
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
16437
fbc0b3b38c79 patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents: 16423
diff changeset
8 source shared.vim
fbc0b3b38c79 patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents: 16423
diff changeset
9
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
10 " xterm2 and sgr always work, urxvt is optional.
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
11 let s:ttymouse_values = ['xterm2', 'sgr']
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
12 if has('mouse_urxvt')
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
13 call add(s:ttymouse_values, 'urxvt')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
14 endif
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
15
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
16 " dec doesn't support all the functionality
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
17 if has('mouse_dec')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
18 let s:ttymouse_dec = ['dec']
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
19 else
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
20 let s:ttymouse_dec = []
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
21 endif
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
22
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
23 " netterm only supports left click
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
24 if has('mouse_netterm')
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
25 let s:ttymouse_netterm = ['netterm']
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
26 else
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
27 let s:ttymouse_netterm = []
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
28 endif
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
29
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
30 " Helper function to emit a terminal escape code.
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
31 func TerminalEscapeCode(code, row, col, m)
16352
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
32 if &ttymouse ==# 'xterm2'
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
33 " need to use byte encoding here.
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
34 let str = list2str([a:code + 0x20, a:col + 0x20, a:row + 0x20])
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
35 if has('iconv')
17914
af3d441845cd patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
36 let bytes = str->iconv('utf-8', 'latin1')
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
37 else
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
38 " Hopefully the numbers are not too big.
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
39 let bytes = str
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
40 endif
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
41 call feedkeys("\<Esc>[M" .. bytes, 'Lx!')
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
42 elseif &ttymouse ==# 'sgr'
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
43 call feedkeys(printf("\<Esc>[<%d;%d;%d%s", a:code, a:col, a:row, a:m), 'Lx!')
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
44 elseif &ttymouse ==# 'urxvt'
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
45 call feedkeys(printf("\<Esc>[%d;%d;%dM", a:code + 0x20, a:col, a:row), 'Lx!')
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
46 endif
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
47 endfunc
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
48
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
49 func DecEscapeCode(code, down, row, col)
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
50 call feedkeys(printf("\<Esc>[%d;%d;%d;%d&w", a:code, a:down, a:row, a:col), 'Lx!')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
51 endfunc
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
52
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
53 func NettermEscapeCode(row, col)
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
54 call feedkeys(printf("\<Esc>}%d,%d\r", a:row, a:col), 'Lx!')
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
55 endfunc
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
56
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
57 func MouseLeftClick(row, col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
58 if &ttymouse ==# 'dec'
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
59 call DecEscapeCode(2, 4, a:row, a:col)
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
60 elseif &ttymouse ==# 'netterm'
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
61 call NettermEscapeCode(a:row, a:col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
62 else
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
63 call TerminalEscapeCode(0, a:row, a:col, 'M')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
64 endif
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
65 endfunc
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
66
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
67 func MouseMiddleClick(row, col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
68 if &ttymouse ==# 'dec'
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
69 call DecEscapeCode(4, 2, a:row, a:col)
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
70 else
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
71 call TerminalEscapeCode(1, a:row, a:col, 'M')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
72 endif
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
73 endfunc
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
74
18307
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
75 func MouseRightClick(row, col)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
76 if &ttymouse ==# 'dec'
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
77 call DecEscapeCode(6, 1, a:row, a:col)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
78 else
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
79 call TerminalEscapeCode(2, a:row, a:col, 'M')
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
80 endif
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
81 endfunc
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
82
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
83 func MouseCtrlLeftClick(row, col)
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
84 let ctrl = 0x10
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
85 call TerminalEscapeCode(0 + ctrl, a:row, a:col, 'M')
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
86 endfunc
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
87
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
88 func MouseCtrlRightClick(row, col)
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
89 let ctrl = 0x10
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
90 call TerminalEscapeCode(2 + ctrl, a:row, a:col, 'M')
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
91 endfunc
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
92
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
93 func MouseLeftRelease(row, col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
94 if &ttymouse ==# 'dec'
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
95 call DecEscapeCode(3, 0, a:row, a:col)
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
96 elseif &ttymouse ==# 'netterm'
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
97 " send nothing
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
98 else
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
99 call TerminalEscapeCode(3, a:row, a:col, 'm')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
100 endif
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
101 endfunc
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
102
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
103 func MouseMiddleRelease(row, col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
104 if &ttymouse ==# 'dec'
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
105 call DecEscapeCode(5, 0, a:row, a:col)
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
106 else
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
107 call TerminalEscapeCode(3, a:row, a:col, 'm')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
108 endif
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
109 endfunc
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
110
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
111 func MouseRightRelease(row, col)
18307
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
112 if &ttymouse ==# 'dec'
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
113 call DecEscapeCode(7, 0, a:row, a:col)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
114 else
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
115 call TerminalEscapeCode(3, a:row, a:col, 'm')
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
116 endif
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
117 endfunc
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
118
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
119 func MouseLeftDrag(row, col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
120 if &ttymouse ==# 'dec'
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
121 call DecEscapeCode(1, 4, a:row, a:col)
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
122 else
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
123 call TerminalEscapeCode(0x20, a:row, a:col, 'M')
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
124 endif
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
125 endfunc
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
126
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
127 func MouseWheelUp(row, col)
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
128 call TerminalEscapeCode(0x40, a:row, a:col, 'M')
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
129 endfunc
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
130
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
131 func MouseWheelDown(row, col)
16487
a4732cdcfaaf patch 8.1.1247: urxvt mouse codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 16481
diff changeset
132 call TerminalEscapeCode(0x41, a:row, a:col, 'M')
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
133 endfunc
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
134
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
135 func Test_term_mouse_left_click()
16263
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 new
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 let save_mouse = &mouse
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 let save_term = &term
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
140 call test_override('no_query_mouse', 1)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
141 set mouse=a term=xterm
16263
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer'])
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
144 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec + s:ttymouse_netterm
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
145 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
146 exe 'set ttymouse=' .. ttymouse_val
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
147 go
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
148 call assert_equal([0, 1, 1, 0], getpos('.'), msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
149 let row = 2
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
150 let col = 6
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
151 call MouseLeftClick(row, col)
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
152 call MouseLeftRelease(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
153 call assert_equal([0, 2, 6, 0], getpos('.'), msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
154 endfor
16263
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 let &mouse = save_mouse
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 let &term = save_term
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
159 call test_override('no_query_mouse', 0)
16263
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 bwipe!
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 endfunc
d3377393e3d9 patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162
18307
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
163 func Test_xterm_mouse_right_click_extends_visual()
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
164 if has('mac')
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
165 throw "Skipped: test right click in visual mode does not work on macOs (why?)"
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
166 endif
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
167 let save_mouse = &mouse
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
168 let save_term = &term
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
169 let save_ttymouse = &ttymouse
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
170 call test_override('no_query_mouse', 1)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
171 set mouse=a term=xterm
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
172
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
173 for visual_mode in ["v", "V", "\<C-V>"]
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
174 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
175 let msg = 'visual=' .. visual_mode .. ' ttymouse=' .. ttymouse_val
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
176 exe 'set ttymouse=' .. ttymouse_val
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
177
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
178 call setline(1, repeat([repeat('-', 7)], 7))
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
179 call MouseLeftClick(4, 4)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
180 call MouseLeftRelease(4, 4)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
181 exe "norm! " .. visual_mode
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
182
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
183 " Right click extends top left of visual area.
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
184 call MouseRightClick(2, 2)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
185 call MouseRightRelease(2, 2)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
186
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
187 " Right click extends bottom bottom right of visual area.
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
188 call MouseRightClick(6, 6)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
189 call MouseRightRelease(6, 6)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
190 norm! r1gv
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
191
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
192 " Right click shrinks top left of visual area.
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
193 call MouseRightClick(3, 3)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
194 call MouseRightRelease(3, 3)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
195
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
196 " Right click shrinks bottom right of visual area.
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
197 call MouseRightClick(5, 5)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
198 call MouseRightRelease(5, 5)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
199 norm! r2
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
200
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
201 if visual_mode ==# 'v'
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
202 call assert_equal(['-------',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
203 \ '-111111',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
204 \ '1122222',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
205 \ '2222222',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
206 \ '2222211',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
207 \ '111111-',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
208 \ '-------'], getline(1, '$'), msg)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
209 elseif visual_mode ==# 'V'
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
210 call assert_equal(['-------',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
211 \ '1111111',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
212 \ '2222222',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
213 \ '2222222',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
214 \ '2222222',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
215 \ '1111111',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
216 \ '-------'], getline(1, '$'), msg)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
217 else
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
218 call assert_equal(['-------',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
219 \ '-11111-',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
220 \ '-12221-',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
221 \ '-12221-',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
222 \ '-12221-',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
223 \ '-11111-',
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
224 \ '-------'], getline(1, '$'), msg)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
225 endif
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
226 endfor
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
227 endfor
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
228
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
229 let &mouse = save_mouse
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
230 let &term = save_term
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
231 let &ttymouse = save_ttymouse
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
232 call test_override('no_query_mouse', 0)
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
233 bwipe!
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
234 endfunc
176fa195b95d patch 8.1.2148: no test for right click extending Visual area
Bram Moolenaar <Bram@vim.org>
parents: 18301
diff changeset
235
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
236 " Test that <C-LeftMouse> jumps to help tag and <C-RightMouse> jumps back.
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
237 func Test_xterm_mouse_ctrl_click()
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
238 let save_mouse = &mouse
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
239 let save_term = &term
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
240 let save_ttymouse = &ttymouse
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
241 set mouse=a term=xterm
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
242
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
243 for ttymouse_val in s:ttymouse_values
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
244 let msg = 'ttymouse=' .. ttymouse_val
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
245 exe 'set ttymouse=' .. ttymouse_val
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
246 help
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
247 /usr_02.txt
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
248 norm! zt
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
249 let row = 1
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
250 let col = 1
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
251 call MouseCtrlLeftClick(row, col)
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
252 call MouseLeftRelease(row, col)
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
253 call assert_match('usr_02.txt$', bufname('%'), msg)
18223
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
254 call assert_equal('*usr_02.txt*', expand('<cWORD>'), msg)
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
255
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
256 call MouseCtrlRightClick(row, col)
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
257 call MouseRightRelease(row, col)
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
258 call assert_match('help.txt$', bufname('%'), msg)
18223
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
259 call assert_equal('|usr_02.txt|', expand('<cWORD>'), msg)
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
260
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
261 helpclose
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
262 endfor
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
263
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
264 let &mouse = save_mouse
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
265 let &term = save_term
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
266 let &ttymouse = save_ttymouse
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
267 endfunc
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
268
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
269 func Test_term_mouse_middle_click()
17686
853afcc375b2 patch 8.1.1840: Testing: WorkingClipboard() is not accurate
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
270 CheckFeature clipboard_working
16437
fbc0b3b38c79 patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents: 16423
diff changeset
271
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
272 new
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
273 let save_mouse = &mouse
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
274 let save_term = &term
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
275 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
276 call test_override('no_query_mouse', 1)
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
277 let save_quotestar = @*
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
278 let @* = 'abc'
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
279 set mouse=a term=xterm
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
280
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
281 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
282 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
283 exe 'set ttymouse=' .. ttymouse_val
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
284 call setline(1, ['123456789', '123456789'])
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
285
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
286 " Middle-click in the middle of the line pastes text where clicked.
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
287 let row = 1
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
288 let col = 6
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
289 call MouseMiddleClick(row, col)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
290 call MouseMiddleRelease(row, col)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
291 call assert_equal(['12345abc6789', '123456789'], getline(1, '$'), msg)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
292
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
293 " Middle-click beyond end of the line pastes text at the end of the line.
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
294 let col = 20
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
295 call MouseMiddleClick(row, col)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
296 call MouseMiddleRelease(row, col)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
297 call assert_equal(['12345abc6789abc', '123456789'], getline(1, '$'), msg)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
298
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
299 " Middle-click beyond the last line pastes in the last line.
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
300 let row = 5
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
301 let col = 3
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
302 call MouseMiddleClick(row, col)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
303 call MouseMiddleRelease(row, col)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
304 call assert_equal(['12345abc6789abc', '12abc3456789'], getline(1, '$'), msg)
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
305 endfor
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
306
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
307 let &mouse = save_mouse
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
308 let &term = save_term
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
309 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
310 call test_override('no_query_mouse', 0)
16423
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
311 let @* = save_quotestar
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
312 bwipe!
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
313 endfunc
4182fa3b9f70 patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16352
diff changeset
314
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
315 " TODO: for unclear reasons this test fails if it comes after
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
316 " Test_xterm_mouse_ctrl_click()
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
317 func Test_1xterm_mouse_wheel()
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
318 new
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
319 let save_mouse = &mouse
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
320 let save_term = &term
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
321 let save_ttymouse = &ttymouse
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
322 set mouse=a term=xterm
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
323 call setline(1, range(1, 100))
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
324
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
325 for ttymouse_val in s:ttymouse_values
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
326 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
327 exe 'set ttymouse=' .. ttymouse_val
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
328 go
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
329 call assert_equal(1, line('w0'), msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
330 call assert_equal([0, 1, 1, 0], getpos('.'), msg)
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
331
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
332 call MouseWheelDown(1, 1)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
333 call assert_equal(4, line('w0'), msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
334 call assert_equal([0, 4, 1, 0], getpos('.'), msg)
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
335
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
336 call MouseWheelDown(1, 1)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
337 call assert_equal(7, line('w0'), msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
338 call assert_equal([0, 7, 1, 0], getpos('.'), msg)
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
339
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
340 call MouseWheelUp(1, 1)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
341 call assert_equal(4, line('w0'), msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
342 call assert_equal([0, 7, 1, 0], getpos('.'), msg)
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
343
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
344 call MouseWheelUp(1, 1)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
345 call assert_equal(1, line('w0'), msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
346 call assert_equal([0, 7, 1, 0], getpos('.'), msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
347 endfor
16265
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
348
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
349 let &mouse = save_mouse
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
350 let &term = save_term
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
351 let &ttymouse = save_ttymouse
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
352 bwipe!
7feb5b90be5f patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16263
diff changeset
353 endfunc
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
354
18223
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
355 " Test that dragging beyond the window (at the bottom and at the top)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
356 " scrolls window content by the number of of lines beyond the window.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
357 func Test_term_mouse_drag_beyond_window()
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
358 let save_mouse = &mouse
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
359 let save_term = &term
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
360 let save_ttymouse = &ttymouse
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
361 call test_override('no_query_mouse', 1)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
362 set mouse=a term=xterm
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
363 let col = 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
364 call setline(1, range(1, 100))
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
365
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
366 " Split into 3 windows, and go into the middle window
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
367 " so we test dragging mouse below and above the window.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
368 2split
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
369 wincmd j
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
370 2split
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
371
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
372 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
373 let msg = 'ttymouse=' .. ttymouse_val
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
374 exe 'set ttymouse=' .. ttymouse_val
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
375
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
376 " Line #10 at the top.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
377 norm! 10zt
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
378 redraw
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
379 call assert_equal(10, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
380 call assert_equal(2, winheight(0), msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
381
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
382 let row = 4
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
383 call MouseLeftClick(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
384 call assert_equal(10, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
385
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
386 " Drag downwards. We're still in the window so topline should
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
387 " not change yet.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
388 let row += 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
389 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
390 call assert_equal(10, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
391
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
392 " We now leave the window at the bottom, so the window content should
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
393 " scroll by 1 line, then 2 lines (etc) as we drag further away.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
394 let row += 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
395 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
396 call assert_equal(11, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
397
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
398 let row += 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
399 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
400 call assert_equal(13, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
401
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
402 " Now drag upwards.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
403 let row -= 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
404 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
405 call assert_equal(14, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
406
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
407 " We're now back in the window so the topline should not change.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
408 let row -= 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
409 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
410 call assert_equal(14, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
411
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
412 let row -= 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
413 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
414 call assert_equal(14, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
415
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
416 " We now leave the window at the top so the window content should
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
417 " scroll by 1 line, then 2, then 3 (etc) in the opposite direction.
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
418 let row -= 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
419 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
420 call assert_equal(13, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
421
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
422 let row -= 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
423 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
424 call assert_equal(11, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
425
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
426 let row -= 1
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
427 call MouseLeftDrag(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
428 call assert_equal(8, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
429
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
430 call MouseLeftRelease(row, col)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
431 call assert_equal(8, winsaveview().topline, msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
432 call assert_equal(2, winheight(0), msg)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
433 endfor
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
434
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
435 let &mouse = save_mouse
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
436 let &term = save_term
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
437 let &ttymouse = save_ttymouse
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
438 call test_override('no_query_mouse', 0)
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
439 bwipe!
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
440 endfunc
8a86e518fa42 patch 8.1.2106: no tests for dragging the mouse beyond the window
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
441
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
442 func Test_term_mouse_drag_window_separator()
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
443 let save_mouse = &mouse
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
444 let save_term = &term
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
445 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
446 call test_override('no_query_mouse', 1)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
447 set mouse=a term=xterm
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
448
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
449 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
450 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
451 exe 'set ttymouse=' .. ttymouse_val
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
452
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
453 " Split horizontally and test dragging the horizontal window separator.
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
454 split
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
455 let rowseparator = winheight(0) + 1
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
456 let row = rowseparator
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
457 let col = 1
16310
5b8b849dc3aa patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents: 16300
diff changeset
458
16352
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
459 " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported.
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
460 if ttymouse_val !=# 'xterm2' || row <= 223
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
461 call MouseLeftClick(row, col)
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
462 let row -= 1
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
463 call MouseLeftDrag(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
464 call assert_equal(rowseparator - 1, winheight(0) + 1, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
465 let row += 1
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
466 call MouseLeftDrag(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
467 call assert_equal(rowseparator, winheight(0) + 1, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
468 call MouseLeftRelease(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
469 call assert_equal(rowseparator, winheight(0) + 1, msg)
16310
5b8b849dc3aa patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents: 16300
diff changeset
470 endif
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
471 bwipe!
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
472
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
473 " Split vertically and test dragging the vertical window separator.
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
474 vsplit
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
475 let colseparator = winwidth(0) + 1
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
476 let row = 1
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
477 let col = colseparator
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
478
16352
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
479 " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported.
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
480 if ttymouse_val !=# 'xterm2' || col <= 223
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
481 call MouseLeftClick(row, col)
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
482 let col -= 1
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
483 call MouseLeftDrag(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
484 call assert_equal(colseparator - 1, winwidth(0) + 1, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
485 let col += 1
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
486 call MouseLeftDrag(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
487 call assert_equal(colseparator, winwidth(0) + 1, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
488 call MouseLeftRelease(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
489 call assert_equal(colseparator, winwidth(0) + 1, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
490 endif
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
491 bwipe!
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
492 endfor
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
493
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
494 let &mouse = save_mouse
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
495 let &term = save_term
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
496 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
497 call test_override('no_query_mouse', 0)
16275
ed5172ae1c32 patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 16265
diff changeset
498 endfunc
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
499
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
500 func Test_term_mouse_drag_statusline()
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
501 let save_mouse = &mouse
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
502 let save_term = &term
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
503 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
504 call test_override('no_query_mouse', 1)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
505 let save_laststatus = &laststatus
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
506 set mouse=a term=xterm laststatus=2
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
507
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
508 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
509 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
510 exe 'set ttymouse=' .. ttymouse_val
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
511
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
512 call assert_equal(1, &cmdheight, msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
513 let rowstatusline = winheight(0) + 1
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
514 let row = rowstatusline
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
515 let col = 1
16310
5b8b849dc3aa patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents: 16300
diff changeset
516
16352
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
517 if ttymouse_val ==# 'xterm2' && row > 223
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
518 " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported.
16310
5b8b849dc3aa patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents: 16300
diff changeset
519 continue
5b8b849dc3aa patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents: 16300
diff changeset
520 endif
5b8b849dc3aa patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents: 16300
diff changeset
521
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
522 call MouseLeftClick(row, col)
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
523 let row -= 1
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
524 call MouseLeftDrag(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
525 call assert_equal(2, &cmdheight, msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
526 call assert_equal(rowstatusline - 1, winheight(0) + 1, msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
527 let row += 1
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
528 call MouseLeftDrag(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
529 call assert_equal(1, &cmdheight, msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
530 call assert_equal(rowstatusline, winheight(0) + 1, msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
531 call MouseLeftRelease(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
532 call assert_equal(1, &cmdheight, msg)
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
533 call assert_equal(rowstatusline, winheight(0) + 1, msg)
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
534 endfor
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
535
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
536 let &mouse = save_mouse
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
537 let &term = save_term
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
538 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
539 call test_override('no_query_mouse', 0)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
540 let &laststatus = save_laststatus
16300
f3d579f009d1 patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16275
diff changeset
541 endfunc
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
542
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
543 func Test_term_mouse_click_tab()
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
544 let save_mouse = &mouse
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
545 let save_term = &term
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
546 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
547 call test_override('no_query_mouse', 1)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
548 set mouse=a term=xterm
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
549 let row = 1
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
550
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
551 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec + s:ttymouse_netterm
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
552 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
553 exe 'set ttymouse=' .. ttymouse_val
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
554 e Xfoo
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
555 tabnew Xbar
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
556
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
557 let a = split(execute(':tabs'), "\n")
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
558 call assert_equal(['Tab page 1',
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
559 \ ' Xfoo',
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
560 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
561 \ '> Xbar'], a, msg)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
562
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
563 " Test clicking on tab names in the tabline at the top.
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
564 let col = 2
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
565 redraw
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
566 call MouseLeftClick(row, col)
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
567 call MouseLeftRelease(row, col)
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
568 let a = split(execute(':tabs'), "\n")
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
569 call assert_equal(['Tab page 1',
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
570 \ '> Xfoo',
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
571 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
572 \ ' Xbar'], a, msg)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
573
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
574 let col = 9
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
575 call MouseLeftClick(row, col)
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
576 call MouseLeftRelease(row, col)
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
577 let a = split(execute(':tabs'), "\n")
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
578 call assert_equal(['Tab page 1',
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
579 \ ' Xfoo',
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
580 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
581 \ '> Xbar'], a, msg)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
582
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
583 %bwipe!
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
584 endfor
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
585
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
586 let &mouse = save_mouse
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
587 let &term = save_term
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
588 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
589 call test_override('no_query_mouse', 0)
16320
57e0f6b4a87d patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents: 16310
diff changeset
590 endfunc
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
591
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
592 func Test_term_mouse_click_X_to_close_tab()
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
593 let save_mouse = &mouse
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
594 let save_term = &term
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
595 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
596 call test_override('no_query_mouse', 1)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
597 set mouse=a term=xterm
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
598 let row = 1
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
599 let col = &columns
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
600
16493
4912193bc5e7 patch 8.1.1250: no test for netterm mouse
Bram Moolenaar <Bram@vim.org>
parents: 16489
diff changeset
601 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec + s:ttymouse_netterm
16352
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
602 if ttymouse_val ==# 'xterm2' && col > 223
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
603 " When 'ttymouse' is 'xterm2', row/col bigger than 223 are not supported.
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
604 continue
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
605 endif
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
606 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
607 exe 'set ttymouse=' .. ttymouse_val
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
608 e Xtab1
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
609 tabnew Xtab2
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
610 tabnew Xtab3
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
611 tabn 2
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
612
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
613 let a = split(execute(':tabs'), "\n")
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
614 call assert_equal(['Tab page 1',
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
615 \ ' Xtab1',
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
616 \ 'Tab page 2',
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
617 \ '> Xtab2',
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
618 \ 'Tab page 3',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
619 \ ' Xtab3'], a, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
620
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
621 " Click on "X" in tabline to close current tab i.e. Xtab2.
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
622 redraw
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
623 call MouseLeftClick(row, col)
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
624 call MouseLeftRelease(row, col)
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
625 let a = split(execute(':tabs'), "\n")
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
626 call assert_equal(['Tab page 1',
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
627 \ ' Xtab1',
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
628 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
629 \ '> Xtab3'], a, msg)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
630
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
631 %bwipe!
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
632 endfor
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
633
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
634 let &mouse = save_mouse
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
635 let &term = save_term
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
636 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
637 call test_override('no_query_mouse', 0)
16324
6b2412d0509f patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents: 16320
diff changeset
638 endfunc
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
639
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
640 func Test_term_mouse_drag_to_move_tab()
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
641 let save_mouse = &mouse
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
642 let save_term = &term
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
643 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
644 call test_override('no_query_mouse', 1)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
645 " Set 'mousetime' to 1 to avoid recognizing a double-click in the loop
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
646 set mouse=a term=xterm mousetime=1
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
647 let row = 1
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
648
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
649 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
650 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
651 exe 'set ttymouse=' .. ttymouse_val
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
652 e Xtab1
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
653 tabnew Xtab2
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
654
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
655 let a = split(execute(':tabs'), "\n")
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
656 call assert_equal(['Tab page 1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
657 \ ' Xtab1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
658 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
659 \ '> Xtab2'], a, msg)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
660 redraw
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
661
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
662 " Click in tab2 and drag it to tab1.
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
663 " Check getcharmod() to verify that click is not
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
664 " interpreted as a spurious double-click.
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
665 call MouseLeftClick(row, 10)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
666 call assert_equal(0, getcharmod(), msg)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
667 for col in [9, 8, 7, 6]
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
668 call MouseLeftDrag(row, col)
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
669 endfor
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
670 call MouseLeftRelease(row, col)
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
671 let a = split(execute(':tabs'), "\n")
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
672 call assert_equal(['Tab page 1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
673 \ '> Xtab2',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
674 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
675 \ ' Xtab1'], a, msg)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
676
18627
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
677 " Click elsewhere so that click in next iteration is not
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
678 " interpreted as unwanted double-click.
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
679 call MouseLeftClick(row, 11)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
680 call MouseLeftRelease(row, 11)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
681
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
682 %bwipe!
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
683 endfor
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
684
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
685 let &mouse = save_mouse
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
686 let &term = save_term
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
687 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
688 call test_override('no_query_mouse', 0)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
689 set mousetime&
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
690 endfunc
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
691
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
692 func Test_term_mouse_double_click_to_create_tab()
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
693 let save_mouse = &mouse
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
694 let save_term = &term
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
695 let save_ttymouse = &ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
696 call test_override('no_query_mouse', 1)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
697 " Set 'mousetime' to a small value, so that double-click works but we don't
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
698 " have to wait long to avoid a triple-click.
18627
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
699 set mouse=a term=xterm mousetime=200
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
700 let row = 1
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
701 let col = 10
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
702
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
703 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
704 let msg = 'ttymouse=' .. ttymouse_val
16481
8428e0edba1b patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents: 16437
diff changeset
705 exe 'set ttymouse=' .. ttymouse_val
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
706 e Xtab1
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
707 tabnew Xtab2
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
708
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
709 let a = split(execute(':tabs'), "\n")
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
710 call assert_equal(['Tab page 1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
711 \ ' Xtab1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
712 \ 'Tab page 2',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
713 \ '> Xtab2'], a, msg)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
714
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
715 redraw
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
716 call MouseLeftClick(row, col)
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
717 " Check getcharmod() to verify that first click is not
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
718 " interpreted as a spurious double-click.
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
719 call assert_equal(0, getcharmod(), msg)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
720 call MouseLeftRelease(row, col)
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
721 call MouseLeftClick(row, col)
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
722 call assert_equal(32, getcharmod(), msg) " double-click
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
723 call MouseLeftRelease(row, col)
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
724 let a = split(execute(':tabs'), "\n")
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
725 call assert_equal(['Tab page 1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
726 \ ' Xtab1',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
727 \ 'Tab page 2',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
728 \ '> [No Name]',
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
729 \ 'Tab page 3',
16346
2fb516abde42 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16342
diff changeset
730 \ ' Xtab2'], a, msg)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
731
18627
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
732 " Click elsewhere so that click in next iteration is not
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
733 " interpreted as unwanted double click.
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
734 call MouseLeftClick(row, col + 1)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
735 call MouseLeftRelease(row, col + 1)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
736
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
737 %bwipe!
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
738 endfor
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
739
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
740 let &mouse = save_mouse
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
741 let &term = save_term
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
742 let &ttymouse = save_ttymouse
16489
42910f306377 patch 8.1.1248: no test for dec mouse
Bram Moolenaar <Bram@vim.org>
parents: 16487
diff changeset
743 call test_override('no_query_mouse', 0)
16340
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
744 set mousetime&
2f70fc41ff7e patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents: 16324
diff changeset
745 endfunc
16348
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
746
18627
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
747 " Test double/triple/quadruple click in normal mode to visually select.
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
748 func Test_term_mouse_multiple_clicks_to_visually_select()
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
749 let save_mouse = &mouse
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
750 let save_term = &term
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
751 let save_ttymouse = &ttymouse
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
752 call test_override('no_query_mouse', 1)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
753 set mouse=a term=xterm mousetime=200
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
754 new
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
755
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
756 for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
757 let msg = 'ttymouse=' .. ttymouse_val
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
758 exe 'set ttymouse=' .. ttymouse_val
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
759 call setline(1, ['foo [foo bar] foo', 'foo'])
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
760
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
761 " Double-click on word should visually select the word.
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
762 call MouseLeftClick(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
763 call assert_equal(0, getcharmod(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
764 call MouseLeftRelease(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
765 call MouseLeftClick(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
766 call assert_equal(32, getcharmod(), msg) " double-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
767 call MouseLeftRelease(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
768 call assert_equal('v', mode(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
769 norm! r1
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
770 call assert_equal(['111 [foo bar] foo', 'foo'], getline(1, '$'), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
771
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
772 " Double-click on opening square bracket should visually
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
773 " select the whole [foo bar].
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
774 call MouseLeftClick(1, 5)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
775 call assert_equal(0, getcharmod(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
776 call MouseLeftRelease(1, 5)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
777 call MouseLeftClick(1, 5)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
778 call assert_equal(32, getcharmod(), msg) " double-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
779 call MouseLeftRelease(1, 5)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
780 call assert_equal('v', mode(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
781 norm! r2
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
782 call assert_equal(['111 222222222 foo', 'foo'], getline(1, '$'), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
783
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
784 " Triple-click should visually select the whole line.
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
785 call MouseLeftClick(1, 3)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
786 call assert_equal(0, getcharmod(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
787 call MouseLeftRelease(1, 3)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
788 call MouseLeftClick(1, 3)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
789 call assert_equal(32, getcharmod(), msg) " double-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
790 call MouseLeftRelease(1, 3)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
791 call MouseLeftClick(1, 3)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
792 call assert_equal(64, getcharmod(), msg) " triple-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
793 call MouseLeftRelease(1, 3)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
794 call assert_equal('V', mode(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
795 norm! r3
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
796 call assert_equal(['33333333333333333', 'foo'], getline(1, '$'), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
797
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
798 " Quadruple-click should start visual block select.
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
799 call MouseLeftClick(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
800 call assert_equal(0, getcharmod(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
801 call MouseLeftRelease(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
802 call MouseLeftClick(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
803 call assert_equal(32, getcharmod(), msg) " double-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
804 call MouseLeftRelease(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
805 call MouseLeftClick(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
806 call assert_equal(64, getcharmod(), msg) " triple-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
807 call MouseLeftRelease(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
808 call MouseLeftClick(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
809 call assert_equal(96, getcharmod(), msg) " quadruple-click
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
810 call MouseLeftRelease(1, 2)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
811 call assert_equal("\<c-v>", mode(), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
812 norm! r4
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
813 call assert_equal(['34333333333333333', 'foo'], getline(1, '$'), msg)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
814 endfor
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
815
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
816 let &mouse = save_mouse
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
817 let &term = save_term
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
818 let &ttymouse = save_ttymouse
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
819 set mousetime&
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
820 call test_override('no_query_mouse', 0)
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
821 bwipe!
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
822 endfunc
169c810d4e51 patch 8.1.2306: double and triple clicks are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18360
diff changeset
823
16348
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
824 func Test_xterm_mouse_click_in_fold_columns()
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
825 new
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
826 let save_mouse = &mouse
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
827 let save_term = &term
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
828 let save_ttymouse = &ttymouse
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
829 let save_foldcolumn = &foldcolumn
16352
c742c008953e patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 16348
diff changeset
830 set mouse=a term=xterm foldcolumn=3 ttymouse=xterm2
16348
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
831
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
832 " Create 2 nested folds.
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
833 call setline(1, range(1, 7))
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
834 2,6fold
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
835 norm! zR
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
836 4,5fold
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
837 call assert_equal([-1, -1, -1, 4, 4, -1, -1],
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
838 \ map(range(1, 7), 'foldclosed(v:val)'))
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
839
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
840 " Click in "+" of inner fold in foldcolumn should open it.
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
841 redraw
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
842 let row = 4
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
843 let col = 2
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
844 call MouseLeftClick(row, col)
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
845 call MouseLeftRelease(row, col)
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
846 call assert_equal([-1, -1, -1, -1, -1, -1, -1],
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
847 \ map(range(1, 7), 'foldclosed(v:val)'))
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
848
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
849 " Click in "-" of outer fold in foldcolumn should close it.
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
850 redraw
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
851 let row = 2
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
852 let col = 1
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
853 call MouseLeftClick(row, col)
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
854 call MouseLeftRelease(row, col)
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
855 call assert_equal([-1, 2, 2, 2, 2, 2, -1],
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
856 \ map(range(1, 7), 'foldclosed(v:val)'))
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
857 norm! zR
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
858
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
859 " Click in "|" of inner fold in foldcolumn should close it.
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
860 redraw
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
861 let row = 5
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
862 let col = 2
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
863 call MouseLeftClick(row, col)
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
864 call MouseLeftRelease(row, col)
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
865 call assert_equal([-1, -1, -1, 4, 4, -1, -1],
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
866 \ map(range(1, 7), 'foldclosed(v:val)'))
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
867
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
868 let &foldcolumn = save_foldcolumn
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
869 let &ttymouse = save_ttymouse
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
870 let &term = save_term
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
871 let &mouse = save_mouse
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
872 bwipe!
5f3a86ba4261 patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents: 16346
diff changeset
873 endfunc
16936
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
874
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
875 " This only checks if the sequence is recognized.
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
876 func Test_term_rgb_response()
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
877 set t_RF=x
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
878 set t_RB=y
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
879
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
880 " response to t_RF, 4 digits
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
881 let red = 0x12
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
882 let green = 0x34
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
883 let blue = 0x56
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
884 let seq = printf("\<Esc>]10;rgb:%02x00/%02x00/%02x00\x07", red, green, blue)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
885 call feedkeys(seq, 'Lx!')
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
886 call assert_equal(seq, v:termrfgresp)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
887
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
888 " response to t_RF, 2 digits
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
889 let red = 0x78
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
890 let green = 0x9a
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
891 let blue = 0xbc
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
892 let seq = printf("\<Esc>]10;rgb:%02x/%02x/%02x\x07", red, green, blue)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
893 call feedkeys(seq, 'Lx!')
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
894 call assert_equal(seq, v:termrfgresp)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
895
16940
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
896 " response to t_RB, 4 digits, dark
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
897 set background=light
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17914
diff changeset
898 eval 'background'->test_option_not_set()
16940
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
899 let red = 0x29
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
900 let green = 0x4a
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
901 let blue = 0x6b
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
902 let seq = printf("\<Esc>]11;rgb:%02x00/%02x00/%02x00\x07", red, green, blue)
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
903 call feedkeys(seq, 'Lx!')
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
904 call assert_equal(seq, v:termrbgresp)
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
905 call assert_equal('dark', &background)
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
906
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
907 " response to t_RB, 4 digits, light
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
908 set background=dark
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
909 call test_option_not_set('background')
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
910 let red = 0x81
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
911 let green = 0x63
16936
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
912 let blue = 0x65
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
913 let seq = printf("\<Esc>]11;rgb:%02x00/%02x00/%02x00\x07", red, green, blue)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
914 call feedkeys(seq, 'Lx!')
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
915 call assert_equal(seq, v:termrbgresp)
16940
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
916 call assert_equal('light', &background)
16936
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
917
16940
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
918 " response to t_RB, 2 digits, dark
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
919 set background=light
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
920 call test_option_not_set('background')
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
921 let red = 0x47
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
922 let green = 0x59
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
923 let blue = 0x5b
16936
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
924 let seq = printf("\<Esc>]11;rgb:%02x/%02x/%02x\x07", red, green, blue)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
925 call feedkeys(seq, 'Lx!')
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
926 call assert_equal(seq, v:termrbgresp)
16940
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
927 call assert_equal('dark', &background)
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
928
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
929 " response to t_RB, 2 digits, light
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
930 set background=dark
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
931 call test_option_not_set('background')
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
932 let red = 0x83
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
933 let green = 0xa4
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
934 let blue = 0xc2
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
935 let seq = printf("\<Esc>]11;rgb:%02x/%02x/%02x\x07", red, green, blue)
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
936 call feedkeys(seq, 'Lx!')
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
937 call assert_equal(seq, v:termrbgresp)
1c264ca8f2e8 patch 8.1.1471: 'background' not correctly set for 2-digit rgb termresponse
Bram Moolenaar <Bram@vim.org>
parents: 16936
diff changeset
938 call assert_equal('light', &background)
16936
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
939
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
940 set t_RF= t_RB=
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
941 endfunc
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
942
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
943 " This only checks if the sequence is recognized.
18285
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
944 " This must be after other tests, because it has side effects to xterm
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
945 " properties.
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
946 func Test_xx01_term_style_response()
16936
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
947 " Termresponse is only parsed when t_RV is not empty.
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
948 set t_RV=x
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
949
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
950 " send the termresponse to trigger requesting the XT codes
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
951 let seq = "\<Esc>[>41;337;0c"
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
952 call feedkeys(seq, 'Lx!')
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
953 call assert_equal(seq, v:termresponse)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
954
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
955 let seq = "\<Esc>P1$r2 q\<Esc>\\"
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
956 call feedkeys(seq, 'Lx!')
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
957 call assert_equal(seq, v:termstyleresp)
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
958
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
959 set t_RV=
73e6ed2f69a2 patch 8.1.1469: no test for checking the cursor style response
Bram Moolenaar <Bram@vim.org>
parents: 16493
diff changeset
960 endfunc
16942
5f3e960ce76d patch 8.1.1472: add_termcap_entry() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16940
diff changeset
961
18360
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
962 " This checks the iTerm2 version response.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
963 " This must be after other tests, because it has side effects to xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
964 " properties.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
965 func Test_xx02_iTerm2_response()
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
966 " Termresponse is only parsed when t_RV is not empty.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
967 set t_RV=x
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
968
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
969 " Old versions of iTerm2 used a different style term response.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
970 set ttymouse=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
971 call test_option_not_set('ttymouse')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
972 let seq = "\<Esc>[>0;95;c"
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
973 call feedkeys(seq, 'Lx!')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
974 call assert_equal(seq, v:termresponse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
975 call assert_equal('xterm', &ttymouse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
976
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
977 set ttymouse=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
978 call test_option_not_set('ttymouse')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
979 let seq = "\<Esc>[>0;95;0c"
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
980 call feedkeys(seq, 'Lx!')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
981 call assert_equal(seq, v:termresponse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
982 call assert_equal('sgr', &ttymouse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
983
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
984 set t_RV=
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
985 endfunc
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
986
18285
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
987 " This checks the libvterm version response.
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
988 " This must be after other tests, because it has side effects to xterm
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
989 " properties.
18360
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
990 func Test_xx03_libvterm_response()
18285
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
991 " Termresponse is only parsed when t_RV is not empty.
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
992 set t_RV=x
18311
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
993
18285
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
994 set ttymouse=xterm
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
995 call test_option_not_set('ttymouse')
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
996 let seq = "\<Esc>[>0;100;0c"
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
997 call feedkeys(seq, 'Lx!')
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
998 call assert_equal(seq, v:termresponse)
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
999 call assert_equal('sgr', &ttymouse)
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
1000
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
1001 set t_RV=
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
1002 endfunc
db8cd5e56586 patch 8.1.2137: parsing the termresponse is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18247
diff changeset
1003
18360
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1004 " This checks the Mac Terminal.app version response.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1005 " This must be after other tests, because it has side effects to xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1006 " properties.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1007 func Test_xx04_Mac_Terminal_response()
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1008 " Termresponse is only parsed when t_RV is not empty.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1009 set t_RV=x
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1010
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1011 set ttymouse=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1012 call test_option_not_set('ttymouse')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1013 let seq = "\<Esc>[>1;95;0c"
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1014 call feedkeys(seq, 'Lx!')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1015 call assert_equal(seq, v:termresponse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1016 call assert_equal('sgr', &ttymouse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1017
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1018 " Reset is_not_xterm and is_mac_terminal.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1019 set t_RV=
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1020 set term=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1021 set t_RV=x
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1022 endfunc
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1023
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1024 " This checks the mintty version response.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1025 " This must be after other tests, because it has side effects to xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1026 " properties.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1027 func Test_xx05_mintty_response()
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1028 " Termresponse is only parsed when t_RV is not empty.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1029 set t_RV=x
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1030
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1031 set ttymouse=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1032 call test_option_not_set('ttymouse')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1033 let seq = "\<Esc>[>77;20905;0c"
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1034 call feedkeys(seq, 'Lx!')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1035 call assert_equal(seq, v:termresponse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1036 call assert_equal('sgr', &ttymouse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1037
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1038 set t_RV=
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1039 endfunc
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1040
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1041 " This checks the screen version response.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1042 " This must be after other tests, because it has side effects to xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1043 " properties.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1044 func Test_xx06_screen_response()
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1045 " Termresponse is only parsed when t_RV is not empty.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1046 set t_RV=x
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1047
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1048 " Old versions of screen don't support SGR mouse mode.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1049 set ttymouse=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1050 call test_option_not_set('ttymouse')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1051 let seq = "\<Esc>[>83;40500;0c"
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1052 call feedkeys(seq, 'Lx!')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1053 call assert_equal(seq, v:termresponse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1054 call assert_equal('xterm', &ttymouse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1055
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1056 " screen supports SGR mouse mode starting in version 4.7.
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1057 set ttymouse=xterm
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1058 call test_option_not_set('ttymouse')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1059 let seq = "\<Esc>[>83;40700;0c"
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1060 call feedkeys(seq, 'Lx!')
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1061 call assert_equal(seq, v:termresponse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1062 call assert_equal('sgr', &ttymouse)
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1063
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1064 set t_RV=
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1065 endfunc
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1066
18311
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1067 " This checks the xterm version response.
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1068 " This must be after other tests, because it has side effects to xterm
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1069 " properties.
18360
e460e6878406 patch 8.1.2174: screen not recognized as supporting "sgr" mouse codes
Bram Moolenaar <Bram@vim.org>
parents: 18350
diff changeset
1070 func Test_xx07_xterm_response()
18311
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1071 " Termresponse is only parsed when t_RV is not empty.
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1072 set t_RV=x
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1073
18350
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1074 " Do Terminal.app first to check that is_mac_terminal is reset.
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1075 set ttymouse=xterm
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1076 call test_option_not_set('ttymouse')
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1077 let seq = "\<Esc>[>1;95;0c"
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1078 call feedkeys(seq, 'Lx!')
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1079 call assert_equal(seq, v:termresponse)
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1080 call assert_equal('sgr', &ttymouse)
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1081
18311
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1082 " xterm < 95: "xterm" (actually unmodified)
18350
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1083 set t_RV=
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1084 set term=xterm
b1796f1b28fa patch 8.1.2169: terminal flags are never reset
Bram Moolenaar <Bram@vim.org>
parents: 18311
diff changeset
1085 set t_RV=x
18311
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1086 set ttymouse=xterm
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1087 call test_option_not_set('ttymouse')
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1088 let seq = "\<Esc>[>0;94;0c"
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1089 call feedkeys(seq, 'Lx!')
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1090 call assert_equal(seq, v:termresponse)
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1091 call assert_equal('xterm', &ttymouse)
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1092
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1093 " xterm >= 95 < 277 "xterm2"
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1094 set ttymouse=xterm
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1095 call test_option_not_set('ttymouse')
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1096 let seq = "\<Esc>[>0;267;0c"
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1097 call feedkeys(seq, 'Lx!')
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1098 call assert_equal(seq, v:termresponse)
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1099 call assert_equal('xterm2', &ttymouse)
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1100
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1101 " xterm >= 277: "sgr"
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1102 set ttymouse=xterm
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1103 call test_option_not_set('ttymouse')
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1104 let seq = "\<Esc>[>0;277;0c"
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1105 call feedkeys(seq, 'Lx!')
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1106 call assert_equal(seq, v:termresponse)
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1107 call assert_equal('sgr', &ttymouse)
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1108
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1109 set t_RV=
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1110 endfunc
60fce48438e2 patch 8.1.2150: no test for 'ttymouse' set from xterm version response
Bram Moolenaar <Bram@vim.org>
parents: 18307
diff changeset
1111
16942
5f3e960ce76d patch 8.1.1472: add_termcap_entry() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16940
diff changeset
1112 func Test_get_termcode()
18247
eda5b2cb1dc4 patch 8.1.2118: termcodes test fails when $TERM is "dumb"
Bram Moolenaar <Bram@vim.org>
parents: 18223
diff changeset
1113 try
eda5b2cb1dc4 patch 8.1.2118: termcodes test fails when $TERM is "dumb"
Bram Moolenaar <Bram@vim.org>
parents: 18223
diff changeset
1114 let k1 = &t_k1
eda5b2cb1dc4 patch 8.1.2118: termcodes test fails when $TERM is "dumb"
Bram Moolenaar <Bram@vim.org>
parents: 18223
diff changeset
1115 catch /E113/
eda5b2cb1dc4 patch 8.1.2118: termcodes test fails when $TERM is "dumb"
Bram Moolenaar <Bram@vim.org>
parents: 18223
diff changeset
1116 throw 'Skipped: Unable to query termcodes'
eda5b2cb1dc4 patch 8.1.2118: termcodes test fails when $TERM is "dumb"
Bram Moolenaar <Bram@vim.org>
parents: 18223
diff changeset
1117 endtry
16942
5f3e960ce76d patch 8.1.1472: add_termcap_entry() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16940
diff changeset
1118 set t_k1=
5f3e960ce76d patch 8.1.1472: add_termcap_entry() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16940
diff changeset
1119 set t_k1&
5f3e960ce76d patch 8.1.1472: add_termcap_entry() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16940
diff changeset
1120 call assert_equal(k1, &t_k1)
16947
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1121
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1122 " use external termcap first
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1123 set nottybuiltin
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1124 set t_k1=
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1125 set t_k1&
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1126 " when using external termcap may get something else, but it must not be
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1127 " empty, since we would fallback to the builtin one.
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1128 call assert_notequal('', &t_k1)
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1129
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1130 if &term =~ 'xterm'
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1131 " use internal termcap first
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1132 let term_save = &term
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1133 let &term = 'builtin_' .. &term
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1134 set t_k1=
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1135 set t_k1&
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1136 call assert_equal(k1, &t_k1)
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1137 let &term = term_save
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1138 endif
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1139
b2179cf1a0a5 patch 8.1.1474: 'ttybuiltin' is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16942
diff changeset
1140 set ttybuiltin
16942
5f3e960ce76d patch 8.1.1472: add_termcap_entry() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 16940
diff changeset
1141 endfunc
18289
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1142
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1143 func GetEscCodeCSI27(key, modifier)
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1144 let key = printf("%d", char2nr(a:key))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1145 let mod = printf("%d", a:modifier)
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1146 return "\<Esc>[27;" .. mod .. ';' .. key .. '~'
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1147 endfunc
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1148
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1149 func GetEscCodeCSIu(key, modifier)
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1150 let key = printf("%d", char2nr(a:key))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1151 let mod = printf("%d", a:modifier)
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1152 return "\<Esc>[" .. key .. ';' .. mod .. 'u'
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1153 endfunc
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1154
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1155 " This checks the CSI sequences when in modifyOtherKeys mode.
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1156 " The mode doesn't need to be enabled, the codes are always detected.
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1157 func RunTest_modifyOtherKeys(func)
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1158 new
18301
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1159 set timeoutlen=10
18289
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1160
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1161 " Shift-X is send as 'X' with the shift modifier
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1162 call feedkeys('a' .. a:func('X', 2) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1163 call assert_equal('X', getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1164
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1165 " Ctrl-i is Tab
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1166 call setline(1, '')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1167 call feedkeys('a' .. a:func('i', 5) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1168 call assert_equal("\t", getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1169
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1170 " Ctrl-I is also Tab
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1171 call setline(1, '')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1172 call feedkeys('a' .. a:func('I', 5) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1173 call assert_equal("\t", getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1174
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1175 " Alt-x is ø
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1176 call setline(1, '')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1177 call feedkeys('a' .. a:func('x', 3) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1178 call assert_equal("ø", getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1179
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1180 " Meta-x is also ø
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1181 call setline(1, '')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1182 call feedkeys('a' .. a:func('x', 9) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1183 call assert_equal("ø", getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1184
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1185 " Alt-X is Ø
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1186 call setline(1, '')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1187 call feedkeys('a' .. a:func('X', 3) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1188 call assert_equal("Ø", getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1189
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1190 " Meta-X is ø
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1191 call setline(1, '')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1192 call feedkeys('a' .. a:func('X', 9) .. "\<Esc>", 'Lx!')
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1193 call assert_equal("Ø", getline(1))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1194
18683
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1195 " Ctrl-6 is Ctrl-^
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1196 split aaa
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1197 edit bbb
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1198 call feedkeys(a:func('6', 5), 'Lx!')
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1199 call assert_equal("aaa", bufname())
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1200 bwipe aaa
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1201 bwipe bbb
5ed740336224 patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 18627
diff changeset
1202
18289
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1203 bwipe!
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1204 set timeoutlen&
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1205 endfunc
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1206
18301
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1207 func Test_modifyOtherKeys_basic()
18289
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1208 call RunTest_modifyOtherKeys(function('GetEscCodeCSI27'))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1209 call RunTest_modifyOtherKeys(function('GetEscCodeCSIu'))
16dd8ebc2339 patch 8.1.2139: the modifyOtherKeys codes are not tested
Bram Moolenaar <Bram@vim.org>
parents: 18285
diff changeset
1210 endfunc
18295
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1211
18709
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1212 func Test_modifyOtherKeys_no_mapping()
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1213 set timeoutlen=10
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1214
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1215 let @a = 'aaa'
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1216 call feedkeys(":let x = '" .. GetEscCodeCSI27('R', 5) .. GetEscCodeCSI27('R', 5) .. "a'\<CR>", 'Lx!')
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1217 call assert_equal("let x = 'aaa'", @:)
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1218
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1219 new
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1220 call feedkeys("a" .. GetEscCodeCSI27('R', 5) .. GetEscCodeCSI27('R', 5) .. "a\<Esc>", 'Lx!')
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1221 call assert_equal("aaa", getline(1))
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1222 bwipe!
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1223
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1224 new
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1225 call feedkeys("axx\<CR>yy" .. GetEscCodeCSI27('G', 5) .. GetEscCodeCSI27('K', 5) .. "a\<Esc>", 'Lx!')
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1226 call assert_equal("axx", getline(1))
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1227 call assert_equal("yy", getline(2))
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1228 bwipe!
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1229
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1230 set timeoutlen&
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1231 endfunc
ac08c7ad9d37 patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18683
diff changeset
1232
18295
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1233 func RunTest_mapping_shift(key, func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1234 call setline(1, '')
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1235 if a:key == '|'
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1236 exe 'inoremap \| xyz'
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1237 else
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1238 exe 'inoremap ' .. a:key .. ' xyz'
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1239 endif
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1240 call feedkeys('a' .. a:func(a:key, 2) .. "\<Esc>", 'Lx!')
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1241 call assert_equal("xyz", getline(1))
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1242 if a:key == '|'
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1243 exe 'iunmap \|'
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1244 else
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1245 exe 'iunmap ' .. a:key
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1246 endif
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1247 endfunc
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1248
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1249 func RunTest_mapping_works_with_shift(func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1250 new
18301
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1251 set timeoutlen=10
18295
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1252
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1253 call RunTest_mapping_shift('@', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1254 call RunTest_mapping_shift('A', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1255 call RunTest_mapping_shift('Z', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1256 call RunTest_mapping_shift('^', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1257 call RunTest_mapping_shift('_', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1258 call RunTest_mapping_shift('{', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1259 call RunTest_mapping_shift('|', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1260 call RunTest_mapping_shift('}', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1261 call RunTest_mapping_shift('~', a:func)
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1262
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1263 bwipe!
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1264 set timeoutlen&
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1265 endfunc
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1266
18301
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1267 func Test_mapping_works_with_shift_plain()
18295
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1268 call RunTest_mapping_works_with_shift(function('GetEscCodeCSI27'))
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1269 call RunTest_mapping_works_with_shift(function('GetEscCodeCSIu'))
43e9523f6d84 patch 8.1.2142: some key mappings do not work with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18289
diff changeset
1270 endfunc
18301
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1271
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1272 func RunTest_mapping_mods(map, key, func, code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1273 call setline(1, '')
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1274 exe 'inoremap ' .. a:map .. ' xyz'
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1275 call feedkeys('a' .. a:func(a:key, a:code) .. "\<Esc>", 'Lx!')
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1276 call assert_equal("xyz", getline(1))
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1277 exe 'iunmap ' .. a:map
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1278 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1279
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1280 func RunTest_mapping_works_with_mods(func, mods, code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1281 new
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1282 set timeoutlen=10
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1283
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1284 if a:mods !~ 'S'
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1285 " Shift by itself has no effect
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1286 call RunTest_mapping_mods('<' .. a:mods .. '-@>', '@', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1287 endif
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1288 call RunTest_mapping_mods('<' .. a:mods .. '-A>', 'A', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1289 call RunTest_mapping_mods('<' .. a:mods .. '-Z>', 'Z', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1290 if a:mods !~ 'S'
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1291 " with Shift code is always upper case
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1292 call RunTest_mapping_mods('<' .. a:mods .. '-a>', 'a', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1293 call RunTest_mapping_mods('<' .. a:mods .. '-z>', 'z', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1294 endif
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1295 if a:mods != 'A'
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1296 " with Alt code is not in upper case
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1297 call RunTest_mapping_mods('<' .. a:mods .. '-a>', 'A', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1298 call RunTest_mapping_mods('<' .. a:mods .. '-z>', 'Z', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1299 endif
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1300 call RunTest_mapping_mods('<' .. a:mods .. '-á>', 'á', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1301 if a:mods !~ 'S'
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1302 " Shift by itself has no effect
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1303 call RunTest_mapping_mods('<' .. a:mods .. '-^>', '^', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1304 call RunTest_mapping_mods('<' .. a:mods .. '-_>', '_', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1305 call RunTest_mapping_mods('<' .. a:mods .. '-{>', '{', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1306 call RunTest_mapping_mods('<' .. a:mods .. '-\|>', '|', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1307 call RunTest_mapping_mods('<' .. a:mods .. '-}>', '}', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1308 call RunTest_mapping_mods('<' .. a:mods .. '-~>', '~', a:func, a:code)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1309 endif
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1310
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1311 bwipe!
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1312 set timeoutlen&
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1313 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1314
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1315 func Test_mapping_works_with_shift()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1316 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'S', 2)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1317 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'S', 2)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1318 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1319
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1320 func Test_mapping_works_with_ctrl()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1321 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C', 5)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1322 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C', 5)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1323 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1324
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1325 func Test_mapping_works_with_shift_ctrl()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1326 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C-S', 6)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1327 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C-S', 6)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1328 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1329
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1330 " Below we also test the "u" code with Alt, This works, but libvterm would not
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1331 " send the Alt key like this but by prefixing an Esc.
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1332
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1333 func Test_mapping_works_with_alt()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1334 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'A', 3)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1335 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'A', 3)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1336 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1337
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1338 func Test_mapping_works_with_shift_alt()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1339 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'S-A', 4)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1340 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'S-A', 4)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1341 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1342
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1343 func Test_mapping_works_with_ctrl_alt()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1344 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C-A', 7)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1345 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C-A', 7)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1346 endfunc
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1347
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1348 func Test_mapping_works_with_shift_ctrl_alt()
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1349 call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C-S-A', 8)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1350 call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C-S-A', 8)
506bf60a30a0 patch 8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Bram Moolenaar <Bram@vim.org>
parents: 18295
diff changeset
1351 endfunc
18717
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1352
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1353 func Test_insert_literal()
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1354 set timeoutlen=10
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1355 new
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1356 " CTRL-V CTRL-X inserts a ^X
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1357 call feedkeys('a' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1358 call assert_equal("\<C-X>", getline(1))
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1359
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1360 call setline(1, '')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1361 call feedkeys('a' .. GetEscCodeCSI27('V', '5') .. GetEscCodeCSI27('X', '5') .. "\<Esc>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1362 call assert_equal("\<C-X>", getline(1))
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1363
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1364 " CTRL-SHIFT-V CTRL-X inserts escape sequencd
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1365 call setline(1, '')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1366 call feedkeys('a' .. GetEscCodeCSIu('V', '6') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1367 call assert_equal("\<Esc>[88;5u", getline(1))
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1368
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1369 call setline(1, '')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1370 call feedkeys('a' .. GetEscCodeCSI27('V', '6') .. GetEscCodeCSI27('X', '5') .. "\<Esc>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1371 call assert_equal("\<Esc>[27;5;88~", getline(1))
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1372
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1373 bwipe!
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1374 set timeoutlen&
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1375 endfunc
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1376
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1377 func Test_cmdline_literal()
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1378 set timeoutlen=10
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1379
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1380 " CTRL-V CTRL-Y inserts a ^Y
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1381 call feedkeys(':' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1382 call assert_equal("\"\<C-Y>", @:)
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1383
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1384 call feedkeys(':' .. GetEscCodeCSI27('V', '5') .. GetEscCodeCSI27('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1385 call assert_equal("\"\<C-Y>", @:)
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1386
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1387 " CTRL-SHIFT-V CTRL-Y inserts escape sequencd
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1388 call feedkeys(':' .. GetEscCodeCSIu('V', '6') .. GetEscCodeCSIu('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1389 call assert_equal("\"\<Esc>[89;5u", @:)
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1390
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1391 call setline(1, '')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1392 call feedkeys(':' .. GetEscCodeCSI27('V', '6') .. GetEscCodeCSI27('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1393 call assert_equal("\"\<Esc>[27;5;89~", @:)
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1394
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1395 set timeoutlen&
14d2a210fab1 patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys
Bram Moolenaar <Bram@vim.org>
parents: 18709
diff changeset
1396 endfunc