Mercurial > vim
annotate src/testdir/mouse.vim @ 19918:ccfeae6af59e v8.2.0515
patch 8.2.0515: some compilers cannot add to "void *"
Commit: https://github.com/vim/vim/commit/b8ed3aa9e708ec0af4e9ee8921ad198f0e949c0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 5 19:09:05 2020 +0200
patch 8.2.0515: some compilers cannot add to "void *"
Problem: Some compilers cannot add to "void *".
Solution: Cast to "char *".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 05 Apr 2020 19:15:33 +0200 |
parents | 0208534b8a84 |
children | d0265fdadec9 |
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 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 func MouseLeftReleaseCode(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 if &ttymouse ==# 'dec' |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 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
|
109 elseif &ttymouse ==# 'netterm' |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 return '' |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 else |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 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
|
113 endif |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 func MouseLeftRelease(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 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
|
118 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 func MouseMiddleReleaseCode(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 if &ttymouse ==# 'dec' |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 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
|
123 else |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 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
|
125 endif |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 func MouseMiddleRelease(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 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
|
130 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 func MouseRightReleaseCode(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 if &ttymouse ==# 'dec' |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 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
|
135 else |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 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
|
137 endif |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 func MouseRightRelease(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 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
|
142 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 func MouseLeftDragCode(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 if &ttymouse ==# 'dec' |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 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
|
147 else |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 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
|
149 endif |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 func MouseLeftDrag(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 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
|
154 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 func MouseWheelUpCode(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 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
|
158 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 func MouseWheelUp(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 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
|
162 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 func MouseWheelDownCode(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 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
|
166 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 func MouseWheelDown(row, col) |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 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
|
170 endfunc |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 |
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 " vim: shiftwidth=2 sts=2 expandtab |