Mercurial > vim
comparison src/testdir/test_termcodes.vim @ 16423:4182fa3b9f70 v8.1.1216
patch 8.1.1216: mouse middle click is not tested
commit https://github.com/vim/vim/commit/c1b8160b44b43cca3acd7a47c1b85350cb648fe5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 27 19:11:35 2019 +0200
patch 8.1.1216: mouse middle click is not tested
Problem: Mouse middle click is not tested.
Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/4310)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Apr 2019 19:15:05 +0200 |
parents | c742c008953e |
children | fbc0b3b38c79 |
comparison
equal
deleted
inserted
replaced
16422:3d98d4be252c | 16423:4182fa3b9f70 |
---|---|
24 | 24 |
25 func MouseLeftClick(row, col) | 25 func MouseLeftClick(row, col) |
26 call TerminalEscapeCode(0x20, 0, a:row, a:col, 'M') | 26 call TerminalEscapeCode(0x20, 0, a:row, a:col, 'M') |
27 endfunc | 27 endfunc |
28 | 28 |
29 func MouseMiddleClick(row, col) | |
30 call TerminalEscapeCode(0x21, 1, a:row, a:col, 'M') | |
31 endfunc | |
32 | |
29 func MouseLeftRelease(row, col) | 33 func MouseLeftRelease(row, col) |
30 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') | 34 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') |
31 endfunc | 35 endfunc |
32 | 36 |
37 func MouseMiddleRelease(row, col) | |
38 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') | |
39 endfunc | |
40 | |
33 func MouseLeftDrag(row, col) | 41 func MouseLeftDrag(row, col) |
34 call TerminalEscapeCode(0x43, 0x20, a:row, a:col, 'M') | 42 call TerminalEscapeCode(0x43, 0x20, a:row, a:col, 'M') |
35 endfunc | 43 endfunc |
36 | 44 |
37 func MouseWheelUp(row, col) | 45 func MouseWheelUp(row, col) |
40 | 48 |
41 func MouseWheelDown(row, col) | 49 func MouseWheelDown(row, col) |
42 call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M') | 50 call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M') |
43 endfunc | 51 endfunc |
44 | 52 |
45 func Test_xterm_mouse_click() | 53 func Test_xterm_mouse_left_click() |
46 new | 54 new |
47 let save_mouse = &mouse | 55 let save_mouse = &mouse |
48 let save_term = &term | 56 let save_term = &term |
49 let save_ttymouse = &ttymouse | 57 let save_ttymouse = &ttymouse |
50 set mouse=a term=xterm | 58 set mouse=a term=xterm |
63 endfor | 71 endfor |
64 | 72 |
65 let &mouse = save_mouse | 73 let &mouse = save_mouse |
66 let &term = save_term | 74 let &term = save_term |
67 let &ttymouse = save_ttymouse | 75 let &ttymouse = save_ttymouse |
76 bwipe! | |
77 endfunc | |
78 | |
79 func Test_xterm_mouse_middle_click() | |
80 new | |
81 let save_mouse = &mouse | |
82 let save_term = &term | |
83 let save_ttymouse = &ttymouse | |
84 let save_quotestar = @* | |
85 let @* = 'abc' | |
86 set mouse=a term=xterm | |
87 | |
88 for ttymouse_val in ['xterm2', 'sgr'] | |
89 let msg = 'ttymouse=' .. ttymouse_val | |
90 exe 'set ttymouse=' . ttymouse_val | |
91 call setline(1, ['123456789', '123456789']) | |
92 | |
93 " Middle-click in the middle of the line pastes text where clicked. | |
94 let row = 1 | |
95 let col = 6 | |
96 call MouseMiddleClick(row, col) | |
97 call MouseMiddleRelease(row, col) | |
98 call assert_equal(['12345abc6789', '123456789'], getline(1, '$'), msg) | |
99 | |
100 " Middle-click beyond end of the line pastes text at the end of the line. | |
101 let col = 20 | |
102 call MouseMiddleClick(row, col) | |
103 call MouseMiddleRelease(row, col) | |
104 call assert_equal(['12345abc6789abc', '123456789'], getline(1, '$'), msg) | |
105 | |
106 " Middle-click beyond the last line pastes in the last line. | |
107 let row = 5 | |
108 let col = 3 | |
109 call MouseMiddleClick(row, col) | |
110 call MouseMiddleRelease(row, col) | |
111 call assert_equal(['12345abc6789abc', '12abc3456789'], getline(1, '$'), msg) | |
112 endfor | |
113 | |
114 let &mouse = save_mouse | |
115 let &term = save_term | |
116 let &ttymouse = save_ttymouse | |
117 let @* = save_quotestar | |
68 bwipe! | 118 bwipe! |
69 endfunc | 119 endfunc |
70 | 120 |
71 func Test_xterm_mouse_wheel() | 121 func Test_xterm_mouse_wheel() |
72 new | 122 new |