Mercurial > vim
annotate src/testdir/test_termcodes.vim @ 16481:8428e0edba1b v8.1.1244
patch 8.1.1244: no tests for CTRL-mouse-click
commit https://github.com/vim/vim/commit/1ee36d6ff5bc51a1ecb5631c3e5bb632b5d1bcfc
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 1 23:13:56 2019 +0200
patch 8.1.1244: no tests for CTRL-mouse-click
Problem: No tests for CTRL-mouse-click.
Solution: Add a few tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/4323)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 01 May 2019 23:15:05 +0200 |
parents | fbc0b3b38c79 |
children | a4732cdcfaaf |
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 |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 if has('gui_running') || !has('unix') |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 finish |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 endif |
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 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
10 " Helper function to emit a terminal escape code. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
11 func TerminalEscapeCode(code_xterm, code_sgr, 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
|
12 if &ttymouse ==# 'xterm2' |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
13 " need to use byte encoding here. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
14 let str = list2str([a:code_xterm, a:col + 0x20, a:row + 0x20]) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
15 if has('iconv') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
16 let bytes = iconv(str, 'utf-8', 'latin1') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
17 else |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
18 " 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
|
19 let bytes = str |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
20 endif |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
21 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
|
22 elseif &ttymouse ==# 'sgr' |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
23 call feedkeys(printf("\<Esc>[<%d;%d;%d%s", a:code_sgr, a:col, a:row, a:m), 'Lx!') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
24 endif |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
25 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
26 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
27 func MouseLeftClick(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
28 call TerminalEscapeCode(0x20, 0, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
29 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
30 |
16423
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
31 func MouseMiddleClick(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
32 call TerminalEscapeCode(0x21, 1, a:row, a:col, 'M') |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
33 endfunc |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
34 |
16481
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
35 func MouseCtrlLeftClick(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
36 let ctrl = 0x10 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
37 call TerminalEscapeCode(0x20 + ctrl, 0 + ctrl, a:row, a:col, 'M') |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
38 endfunc |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
39 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
40 func MouseCtrlRightClick(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
41 let ctrl = 0x10 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
42 call TerminalEscapeCode(0x22 + ctrl, 2 + ctrl, a:row, a:col, 'M') |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
43 endfunc |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
44 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
45 func MouseLeftRelease(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
46 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') |
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 |
16423
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
49 func MouseMiddleRelease(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
50 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
51 endfunc |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
52 |
16481
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
53 func MouseRightRelease(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
54 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
55 endfunc |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
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 MouseLeftDrag(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
58 call TerminalEscapeCode(0x43, 0x20, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
59 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
60 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
61 func MouseWheelUp(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
62 call TerminalEscapeCode(0x40, 0x40, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
63 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
64 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
65 func MouseWheelDown(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
66 call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
67 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
68 |
16423
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
69 func Test_xterm_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
|
70 new |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 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
|
72 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
|
73 let save_ttymouse = &ttymouse |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
74 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
|
75 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
|
76 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
77 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 let row = 2 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
83 let col = 6 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
84 call MouseLeftClick(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
85 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
|
86 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
|
87 endfor |
16263
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 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
|
90 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
|
91 let &ttymouse = save_ttymouse |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 bwipe! |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 endfunc |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 |
16481
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
95 " 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
|
96 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
|
97 let save_mouse = &mouse |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
98 let save_term = &term |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
99 let save_ttymouse = &ttymouse |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
100 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
|
101 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
102 for ttymouse_val in ['xterm2', 'sgr'] |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
103 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
|
104 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
|
105 help |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
106 /usr_02.txt |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
107 norm! zt |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
108 let row = 1 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
109 let col = 1 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
110 call MouseCtrlLeftClick(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
111 call MouseLeftRelease(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
112 call assert_match('usr_02.txt$', bufname('%'), msg) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
113 call assert_equal('*usr_02.txt*', expand('<cWORD>')) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
114 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
115 call MouseCtrlRightClick(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
116 call MouseLeftRelease(row, col) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
117 call assert_match('help.txt$', bufname('%'), msg) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
118 call assert_equal('|usr_02.txt|', expand('<cWORD>')) |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
119 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
120 helpclose |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
121 endfor |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
122 |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
123 let &mouse = save_mouse |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
124 let &term = save_term |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
125 let &ttymouse = save_ttymouse |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
126 endfunc |
8428e0edba1b
patch 8.1.1244: no tests for CTRL-mouse-click
Bram Moolenaar <Bram@vim.org>
parents:
16437
diff
changeset
|
127 |
16423
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
128 func Test_xterm_mouse_middle_click() |
16437
fbc0b3b38c79
patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents:
16423
diff
changeset
|
129 if !WorkingClipboard() |
fbc0b3b38c79
patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents:
16423
diff
changeset
|
130 throw 'Skipped: No working clipboard' |
fbc0b3b38c79
patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents:
16423
diff
changeset
|
131 endif |
fbc0b3b38c79
patch 8.1.1223: middle mouse click test fails without a clipboard
Bram Moolenaar <Bram@vim.org>
parents:
16423
diff
changeset
|
132 |
16423
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
133 new |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
134 let save_mouse = &mouse |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
135 let save_term = &term |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
136 let save_ttymouse = &ttymouse |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
137 let save_quotestar = @* |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
138 let @* = 'abc' |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
139 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
|
140 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
141 for ttymouse_val in ['xterm2', 'sgr'] |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
142 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
|
143 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
|
144 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
|
145 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
146 " 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
|
147 let row = 1 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
148 let col = 6 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
149 call MouseMiddleClick(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
150 call MouseMiddleRelease(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
151 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
|
152 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
153 " 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
|
154 let col = 20 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
155 call MouseMiddleClick(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
156 call MouseMiddleRelease(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
157 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
|
158 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
159 " 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
|
160 let row = 5 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
161 let col = 3 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
162 call MouseMiddleClick(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
163 call MouseMiddleRelease(row, col) |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
164 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
|
165 endfor |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
166 |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
167 let &mouse = save_mouse |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
168 let &term = save_term |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
169 let &ttymouse = save_ttymouse |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
170 let @* = save_quotestar |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
171 bwipe! |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
172 endfunc |
4182fa3b9f70
patch 8.1.1216: mouse middle click is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16352
diff
changeset
|
173 |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
174 func Test_xterm_mouse_wheel() |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
175 new |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
176 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
|
177 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
|
178 let save_ttymouse = &ttymouse |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
179 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
|
180 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
|
181 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
182 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
189 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
|
190 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
|
191 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
|
192 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
197 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
|
198 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
|
199 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
|
200 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
201 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
|
202 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
|
203 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
|
204 endfor |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
205 |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 bwipe! |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
210 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
|
211 |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
212 func Test_xterm_mouse_drag_window_separator() |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
213 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
|
214 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
|
215 let save_ttymouse = &ttymouse |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
216 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
|
217 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
218 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
219 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
|
220 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
|
221 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
222 " 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
|
223 split |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
224 let rowseparator = winheight(0) + 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
225 let row = rowseparator |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
226 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
|
227 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
228 " 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 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
|
239 endif |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
240 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
|
241 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
242 " 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
|
243 vsplit |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
244 let colseparator = winwidth(0) + 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
245 let row = 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
246 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
|
247 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
248 " 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 endif |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
260 bwipe! |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
261 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
|
262 |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
263 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
|
264 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
|
265 let &ttymouse = save_ttymouse |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
266 endfunc |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
267 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
268 func Test_xterm_mouse_drag_statusline() |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
269 let save_mouse = &mouse |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
270 let save_term = &term |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
271 let save_ttymouse = &ttymouse |
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
|
272 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
|
273 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
|
274 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
275 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
276 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
|
277 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
|
278 |
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
|
279 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
|
280 let rowstatusline = winheight(0) + 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
281 let row = rowstatusline |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
282 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
|
283 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
284 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
|
285 " 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
|
286 continue |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
287 endif |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
288 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
289 call MouseLeftClick(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
290 let row -= 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 let row += 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
295 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
|
296 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
|
297 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
|
298 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
|
299 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
|
300 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
|
301 endfor |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
302 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
303 let &mouse = save_mouse |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
304 let &term = save_term |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
305 let &ttymouse = save_ttymouse |
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
|
306 let &laststatus = save_laststatus |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
307 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
|
308 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
309 func Test_xterm_mouse_click_tab() |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
310 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
|
311 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
|
312 let save_ttymouse = &ttymouse |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
313 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
|
314 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
|
315 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
316 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
322 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
|
323 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
|
324 \ ' 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
|
325 \ '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
|
326 \ '> 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
|
327 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
328 " 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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 \ '> 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
|
336 \ '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
|
337 \ ' 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
|
338 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
339 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
|
340 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
|
341 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
|
342 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
|
343 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
|
344 \ ' 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
|
345 \ '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
|
346 \ '> 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
|
347 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
348 %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
|
349 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
|
350 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
351 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
|
352 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
|
353 let &ttymouse = save_ttymouse |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
354 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
|
355 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
356 func Test_xterm_mouse_click_X_to_close_tab() |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
357 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
|
358 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
|
359 let save_ttymouse = &ttymouse |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
360 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
|
361 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
|
362 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
|
363 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
364 for ttymouse_val in ['xterm2', 'sgr'] |
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
365 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
|
366 " 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
|
367 continue |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 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
|
375 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
376 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
|
377 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
|
378 \ ' Xtab1', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
379 \ '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
|
380 \ '> Xtab2', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
381 \ '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
|
382 \ ' 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
|
383 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
384 " 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
|
385 redraw |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 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
|
390 \ ' Xtab1', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
391 \ '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
|
392 \ '> 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
|
393 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
394 %bwipe! |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
395 endfor |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
396 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
397 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
|
398 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
|
399 let &ttymouse = save_ttymouse |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
400 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
|
401 |
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
|
402 func Test_xterm_mouse_drag_to_move_tab() |
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
|
403 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
|
404 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
|
405 let save_ttymouse = &ttymouse |
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
|
406 " 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
|
407 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
|
408 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
|
409 |
16352
c742c008953e
patch 8.1.1181: tests for mouse clicks are a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
16348
diff
changeset
|
410 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
411 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
|
412 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
|
413 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
|
414 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
|
415 |
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
|
416 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
|
417 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
|
418 \ ' 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
|
419 \ '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
|
420 \ '> 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
|
421 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
|
422 |
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
|
423 " 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
|
424 " 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
|
425 " 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
|
426 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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 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
|
434 \ '> 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
|
435 \ '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
|
436 \ ' 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
|
437 |
16342
06f3eb443e93
patch 8.1.1176: test for dragging a tab is flaky
Bram Moolenaar <Bram@vim.org>
parents:
16340
diff
changeset
|
438 " brief sleep to avoid causing a double-click |
06f3eb443e93
patch 8.1.1176: test for dragging a tab is flaky
Bram Moolenaar <Bram@vim.org>
parents:
16340
diff
changeset
|
439 sleep 20m |
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
|
440 %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
|
441 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
|
442 |
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
|
443 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
|
444 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
|
445 let &ttymouse = save_ttymouse |
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
|
446 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
|
447 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
|
448 |
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
|
449 func Test_xterm_mouse_double_click_to_create_tab() |
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
|
450 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
|
451 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
|
452 let save_ttymouse = &ttymouse |
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
|
453 " 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
|
454 " have to wait long to avoid a triple-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
|
455 set mouse=a term=xterm mousetime=100 |
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
|
456 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
|
457 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
|
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 for ttymouse_val in ['xterm2', 'sgr'] |
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
|
460 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
|
461 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
|
462 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
|
463 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
|
464 |
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
|
465 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
|
466 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
|
467 \ ' 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
|
468 \ '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
|
469 \ '> 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
|
470 |
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
|
471 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
|
472 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
|
473 " 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
|
474 " 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
|
475 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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 \ ' 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
|
483 \ '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
|
484 \ '> [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
|
485 \ '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
|
486 \ ' 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
|
487 |
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
|
488 if ttymouse_val !=# 'sgr' |
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
|
489 " We need to sleep, or else MouseLeftClick() in next 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
|
490 " iteration will be interpreted as a spurious triple-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
|
491 sleep 100m |
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
|
492 endif |
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
|
493 %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
|
494 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
|
495 |
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
|
496 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
|
497 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
|
498 let &ttymouse = save_ttymouse |
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
|
499 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
|
500 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
|
501 |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
502 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
|
503 new |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
504 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
|
505 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
|
506 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
|
507 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
|
508 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
|
509 |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
510 " 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
|
511 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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 \ 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
|
517 |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
518 " 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
|
519 redraw |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
520 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 \ 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
|
526 |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
527 " 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
|
528 redraw |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 \ 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
|
535 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
|
536 |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
537 " 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
|
538 redraw |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 \ 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
|
545 |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
546 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
|
547 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
|
548 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
|
549 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
|
550 bwipe! |
5f3a86ba4261
patch 8.1.1179: no test for mouse clicks in the fold column
Bram Moolenaar <Bram@vim.org>
parents:
16346
diff
changeset
|
551 endfunc |