annotate src/testdir/mouse.vim @ 22502:1503ecd54f8a v8.2.1799

patch 8.2.1799: some Normal mode commands not fully tested Commit: https://github.com/vim/vim/commit/d1ad99b65470d3e754f6a0588a6b0dc2214a1eab Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 4 16:16:54 2020 +0200 patch 8.2.1799: some Normal mode commands not fully tested Problem: Some Normal mode commands not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/7073)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Oct 2020 16:30:03 +0200
parents e00467b9f5de
children b9a4699d6a35
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Helper functions for generating mouse events
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " xterm2 and sgr always work, urxvt is optional.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 let g:Ttymouse_values = ['xterm2', 'sgr']
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 if has('mouse_urxvt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 call add(g:Ttymouse_values, 'urxvt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " dec doesn't support all the functionality
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 if has('mouse_dec')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 let g:Ttymouse_dec = ['dec']
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let g:Ttymouse_dec = []
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " netterm only supports left click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 if has('mouse_netterm')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 let g:Ttymouse_netterm = ['netterm']
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let g:Ttymouse_netterm = []
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 " Helper function to emit a terminal escape code.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 func TerminalEscapeCode(code, row, col, m)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 if &ttymouse ==# 'xterm2'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 " need to use byte encoding here.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 let str = list2str([a:code + 0x20, a:col + 0x20, a:row + 0x20])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 if has('iconv')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 let bytes = str->iconv('utf-8', 'latin1')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 " Hopefully the numbers are not too big.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 let bytes = str
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 return "\<Esc>[M" .. bytes
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 elseif &ttymouse ==# 'sgr'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 return printf("\<Esc>[<%d;%d;%d%s", a:code, a:col, a:row, a:m)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 elseif &ttymouse ==# 'urxvt'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 return printf("\<Esc>[%d;%d;%dM", a:code + 0x20, a:col, a:row)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 func DecEscapeCode(code, down, row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 return printf("\<Esc>[%d;%d;%d;%d&w", a:code, a:down, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 func NettermEscapeCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 return printf("\<Esc>}%d,%d\r", a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 func MouseLeftClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 return DecEscapeCode(2, 4, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 elseif &ttymouse ==# 'netterm'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 return NettermEscapeCode(a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 return TerminalEscapeCode(0, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 func MouseLeftClick(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 call feedkeys(MouseLeftClickCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 func MouseMiddleClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 return DecEscapeCode(4, 2, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 return TerminalEscapeCode(1, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 func MouseMiddleClick(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 call feedkeys(MouseMiddleClickCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 func MouseRightClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 return DecEscapeCode(6, 1, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 return TerminalEscapeCode(2, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 func MouseRightClick(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 call feedkeys(MouseRightClickCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 func MouseCtrlLeftClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 let ctrl = 0x10
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 return TerminalEscapeCode(0 + ctrl, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 func MouseCtrlLeftClick(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 call feedkeys(MouseCtrlLeftClickCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 func MouseCtrlRightClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 let ctrl = 0x10
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 return TerminalEscapeCode(2 + ctrl, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 func MouseCtrlRightClick(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 call feedkeys(MouseCtrlRightClickCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105
21369
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
106 func MouseAltLeftClickCode(row, col)
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
107 let alt = 0x8
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
108 return TerminalEscapeCode(0 + alt, a:row, a:col, 'M')
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
109 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
110
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
111 func MouseAltLeftClick(row, col)
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
112 call feedkeys(MouseAltLeftClickCode(a:row, a:col), 'Lx!')
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
113 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
114
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
115 func MouseAltRightClickCode(row, col)
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
116 let alt = 0x8
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
117 return TerminalEscapeCode(2 + alt, a:row, a:col, 'M')
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
118 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
119
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
120 func MouseAltRightClick(row, col)
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
121 call feedkeys(MouseAltRightClickCode(a:row, a:col), 'Lx!')
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
122 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
123
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 func MouseLeftReleaseCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 return DecEscapeCode(3, 0, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 elseif &ttymouse ==# 'netterm'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 return ''
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 return TerminalEscapeCode(3, a:row, a:col, 'm')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 func MouseLeftRelease(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 call feedkeys(MouseLeftReleaseCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 func MouseMiddleReleaseCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 return DecEscapeCode(5, 0, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 return TerminalEscapeCode(3, a:row, a:col, 'm')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 func MouseMiddleRelease(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 call feedkeys(MouseMiddleReleaseCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 func MouseRightReleaseCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 return DecEscapeCode(7, 0, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 return TerminalEscapeCode(3, a:row, a:col, 'm')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 func MouseRightRelease(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 call feedkeys(MouseRightReleaseCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 func MouseLeftDragCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 return DecEscapeCode(1, 4, a:row, a:col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 return TerminalEscapeCode(0x20, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 func MouseLeftDrag(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 call feedkeys(MouseLeftDragCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 func MouseWheelUpCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 return TerminalEscapeCode(0x40, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 func MouseWheelUp(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 call feedkeys(MouseWheelUpCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 func MouseWheelDownCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 return TerminalEscapeCode(0x41, a:row, a:col, 'M')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 func MouseWheelDown(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 call feedkeys(MouseWheelDownCode(a:row, a:col), 'Lx!')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189
21114
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
190 func MouseWheelLeftCode(row, col)
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
191 return TerminalEscapeCode(0x42, a:row, a:col, 'M')
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
192 endfunc
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
193
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
194 func MouseWheelLeft(row, col)
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
195 call feedkeys(MouseWheelLeftCode(a:row, a:col), 'Lx!')
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
196 endfunc
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
197
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
198 func MouseWheelRightCode(row, col)
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
199 return TerminalEscapeCode(0x43, a:row, a:col, 'M')
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
200 endfunc
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
201
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
202 func MouseWheelRight(row, col)
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
203 call feedkeys(MouseWheelRightCode(a:row, a:col), 'Lx!')
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
204 endfunc
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
205
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 " vim: shiftwidth=2 sts=2 expandtab