annotate src/testdir/mouse.vim @ 33811:06219b3bdaf3 v9.0.2121

patch 9.0.2121: [security]: use-after-free in ex_substitute Commit: https://github.com/vim/vim/commit/26c11c56888d01e298cd8044caf860f3c26f57bb Author: Christian Brabandt <cb@256bit.org> Date: Wed Nov 22 21:26:41 2023 +0100 patch 9.0.2121: [security]: use-after-free in ex_substitute Problem: [security]: use-after-free in ex_substitute Solution: always allocate memory closes: #13552 A recursive :substitute command could cause a heap-use-after free in Vim (CVE-2023-48706). The whole reproducible test is a bit tricky, I can only reproduce this reliably when no previous substitution command has been used yet (which is the reason, the test needs to run as first one in the test_substitute.vim file) and as a combination of the `:~` command together with a :s command that contains the special substitution atom `~\=` which will make use of a sub-replace special atom and calls a vim script function. There was a comment in the existing :s code, that already makes the `sub` variable allocate memory so that a recursive :s call won't be able to cause any issues here, so this was known as a potential problem already. But for the current test-case that one does not work, because the substitution does not start with `\=` but with `~\=` (and since there does not yet exist a previous substitution atom, Vim will simply increment the `sub` pointer (which then was not allocated dynamically) and later one happily use a sub-replace special expression (which could then free the `sub` var). The following commit fixes this, by making the sub var always using allocated memory, which also means we need to free the pointer whenever we leave the function. Since sub is now always an allocated variable, we also do no longer need the sub_copy variable anymore, since this one was used to indicated when sub pointed to allocated memory (and had therefore to be freed on exit) and when not. Github Security Advisory: https://github.com/vim/vim/security/advisories/GHSA-c8qm-x72m-q53q Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 22 Nov 2023 22:15:05 +0100
parents b9a4699d6a35
children
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
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
23 " Vim Mouse Codes.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
24 " Used by the GUI and by MS-Windows Consoles.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
25 " Keep these in sync with vim.h
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
26 let s:MOUSE_CODE = {
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
27 \ 'BTN_LEFT' : 0x00,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
28 \ 'BTN_MIDDLE' : 0x01,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
29 \ 'BTN_RIGHT' : 0x02,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
30 \ 'BTN_RELEASE' : 0x03,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
31 \ 'BTN_X1' : 0x300,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
32 \ 'BTN_X2' : 0x400,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
33 \ 'SCRL_DOWN' : 0x100,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
34 \ 'SCRL_UP' : 0x200,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
35 \ 'SCRL_LEFT' : 0x500,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
36 \ 'SCRL_RIGHT' : 0x600,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
37 \ 'MOVE' : 0x700,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
38 \ 'MOD_SHIFT' : 0x04,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
39 \ 'MOD_ALT' : 0x08,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
40 \ 'MOD_CTRL' : 0x10,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
41 \ }
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
42
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
43
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 " 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
45 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
46 if &ttymouse ==# 'xterm2'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 " 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
48 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
49 if has('iconv')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 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
51 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " 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
53 let bytes = str
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 return "\<Esc>[M" .. bytes
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 elseif &ttymouse ==# 'sgr'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 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
58 elseif &ttymouse ==# 'urxvt'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 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
60 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 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
64 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
65 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 func NettermEscapeCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 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
69 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
71 " Send low level mouse event to MS-Windows consoles or GUI
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
72 func MSWinMouseEvent(button, row, col, move, multiclick, modifiers)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
73 let args = { }
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
74 let args.button = a:button
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
75 " Scroll directions are inverted in the GUI, no idea why.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
76 if has('gui_running')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
77 if a:button == s:MOUSE_CODE.SCRL_UP
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
78 let args.button = s:MOUSE_CODE.SCRL_DOWN
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
79 elseif a:button == s:MOUSE_CODE.SCRL_DOWN
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
80 let args.button = s:MOUSE_CODE.SCRL_UP
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
81 elseif a:button == s:MOUSE_CODE.SCRL_LEFT
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
82 let args.button = s:MOUSE_CODE.SCRL_RIGHT
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
83 elseif a:button == s:MOUSE_CODE.SCRL_RIGHT
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
84 let args.button = s:MOUSE_CODE.SCRL_LEFT
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
85 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
86 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
87 let args.row = a:row
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
88 let args.col = a:col
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
89 let args.move = a:move
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
90 let args.multiclick = a:multiclick
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
91 let args.modifiers = a:modifiers
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
92 call test_mswin_event("mouse", args)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
93 unlet args
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
94 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
95
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 func MouseLeftClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 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
99 elseif &ttymouse ==# 'netterm'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 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
101 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 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
103 endif
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 MouseLeftClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
107 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
108 call MSWinMouseEvent(s:MOUSE_CODE.BTN_LEFT, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
109 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
110 call feedkeys(MouseLeftClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
111 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 func MouseMiddleClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 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
117 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 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
119 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 func MouseMiddleClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
123 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
124 call MSWinMouseEvent(s:MOUSE_CODE.BTN_MIDDLE, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
125 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
126 call feedkeys(MouseMiddleClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
127 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 func MouseRightClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 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
133 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 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
135 endif
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 MouseRightClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
139 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
140 call MSWinMouseEvent(s:MOUSE_CODE.BTN_RIGHT, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
141 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
142 call feedkeys(MouseRightClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
143 endif
19738
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 MouseCtrlLeftClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 let ctrl = 0x10
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 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
149 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 func MouseCtrlLeftClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
152 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
153 call MSWinMouseEvent(s:MOUSE_CODE.BTN_LEFT, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
154 \ s:MOUSE_CODE.MOD_CTRL)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
155 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
156 call feedkeys(MouseCtrlLeftClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
157 endif
19738
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 MouseCtrlRightClickCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 let ctrl = 0x10
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 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
163 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 func MouseCtrlRightClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
166 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
167 call MSWinMouseEvent(s:MOUSE_CODE.BTN_RIGHT, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
168 \ s:MOUSE_CODE.MOD_CTRL)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
169 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
170 call feedkeys(MouseCtrlRightClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
171 endif
19738
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
21369
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
174 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
175 let alt = 0x8
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
176 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
177 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
178
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
179 func MouseAltLeftClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
180 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
181 call MSWinMouseEvent(s:MOUSE_CODE.BTN_LEFT, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
182 \ s:MOUSE_CODE.MOD_ALT)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
183 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
184 call feedkeys(MouseAltLeftClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
185 endif
21369
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
186 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
187
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
188 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
189 let alt = 0x8
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
190 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
191 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
192
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
193 func MouseAltRightClick(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
194 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
195 call MSWinMouseEvent(s:MOUSE_CODE.BTN_RIGHT, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
196 \ s:MOUSE_CODE.MOD_ALT)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
197 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
198 call feedkeys(MouseAltRightClickCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
199 endif
21369
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
200 endfunc
e00467b9f5de patch 8.2.1235: Not all mouse codes covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21114
diff changeset
201
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 func MouseLeftReleaseCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 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
205 elseif &ttymouse ==# 'netterm'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 return ''
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 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
209 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 func MouseLeftRelease(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
213 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
214 call MSWinMouseEvent(s:MOUSE_CODE.BTN_RELEASE, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
215 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
216 call feedkeys(MouseLeftReleaseCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
217 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 func MouseMiddleReleaseCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 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
223 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 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
225 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 func MouseMiddleRelease(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
229 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
230 call MSWinMouseEvent(s:MOUSE_CODE.BTN_RELEASE, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
231 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
232 call feedkeys(MouseMiddleReleaseCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
233 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 func MouseRightReleaseCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 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
239 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 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
241 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 func MouseRightRelease(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
245 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
246 call MSWinMouseEvent(s:MOUSE_CODE.BTN_RELEASE, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
247 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
248 call feedkeys(MouseRightReleaseCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
249 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 func MouseLeftDragCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 if &ttymouse ==# 'dec'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 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
255 else
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 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
257 endif
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 func MouseLeftDrag(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
261 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
262 call MSWinMouseEvent(s:MOUSE_CODE.BTN_LEFT, a:row, a:col, 1, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
263 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
264 call feedkeys(MouseLeftDragCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
265 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 func MouseWheelUpCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 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
270 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 func MouseWheelUp(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
273 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
274 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_UP, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
275 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
276 call feedkeys(MouseWheelUpCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
277 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 func MouseWheelDownCode(row, col)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 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
282 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 func MouseWheelDown(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
285 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
286 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_DOWN, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
287 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
288 call feedkeys(MouseWheelDownCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
289 endif
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291
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
292 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
293 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
294 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
295
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
296 func MouseWheelLeft(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
297 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
298 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_LEFT, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
299 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
300 call feedkeys(MouseWheelLeftCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
301 endif
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
302 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
303
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
304 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
305 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
306 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
307
d0265fdadec9 patch 8.2.1108: mouse left-right scroll is not supported in terminal window
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
308 func MouseWheelRight(row, col)
31503
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
309 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
310 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_RIGHT, a:row, a:col, 0, 0, 0)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
311 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
312 call feedkeys(MouseWheelRightCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
313 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
314 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
315
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
316 func MouseShiftWheelUpCode(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
317 " todo feed shift mod.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
318 return TerminalEscapeCode(0x40, a:row, a:col, 'M')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
319 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
320
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
321 func MouseShiftWheelUp(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
322 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
323 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_UP, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
324 \ s:MOUSE_CODE.MOD_SHIFT)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
325 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
326 call feedkeys(MouseShiftWheelUpCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
327 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
328 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
329
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
330 func MouseShiftWheelDownCode(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
331 " todo feed shift mod.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
332 return TerminalEscapeCode(0x41, a:row, a:col, 'M')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
333 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
334
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
335 func MouseShiftWheelDown(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
336 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
337 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_DOWN, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
338 \ s:MOUSE_CODE.MOD_SHIFT)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
339 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
340 call feedkeys(MouseShiftWheelDownCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
341 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
342 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
343
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
344 func MouseShiftWheelLeftCode(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
345 " todo feed shift mod.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
346 return TerminalEscapeCode(0x42, a:row, a:col, 'M')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
347 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
348
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
349 func MouseShiftWheelLeft(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
350 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
351 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_LEFT, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
352 \ s:MOUSE_CODE.MOD_SHIFT)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
353 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
354 call feedkeys(MouseShiftWheelLeftCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
355 endif
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
356 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
357
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
358 func MouseShiftWheelRightCode(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
359 " todo feed shift mod.
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
360 return TerminalEscapeCode(0x43, a:row, a:col, 'M')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
361 endfunc
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
362
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
363 func MouseShiftWheelRight(row, col)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
364 if has('win32')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
365 call MSWinMouseEvent(s:MOUSE_CODE.SCRL_RIGHT, a:row, a:col, 0, 0,
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
366 \ s:MOUSE_CODE.MOD_SHIFT)
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
367 else
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
368 call feedkeys(MouseShiftWheelRightCode(a:row, a:col), 'Lx!')
b9a4699d6a35 patch 9.0.1084: code handling low level MS-Windows events cannot be tested
Bram Moolenaar <Bram@vim.org>
parents: 21369
diff changeset
369 endif
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
370 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
371
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 " vim: shiftwidth=2 sts=2 expandtab