1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1216
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.1216
Problem: Mouse middle click is not tested.
Solution: Add a test. (Dominique Pelle, closes #4310)
Files: src/testdir/test_termcodes.vim
*** ../vim-8.1.1215/src/testdir/test_termcodes.vim 2019-04-17 17:08:22.896875152 +0200
--- src/testdir/test_termcodes.vim 2019-04-27 19:09:47.706543703 +0200
***************
*** 26,35 ****
--- 26,43 ----
call TerminalEscapeCode(0x20, 0, a:row, a:col, 'M')
endfunc
+ func MouseMiddleClick(row, col)
+ call TerminalEscapeCode(0x21, 1, a:row, a:col, 'M')
+ endfunc
+
func MouseLeftRelease(row, col)
call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm')
endfunc
+ func MouseMiddleRelease(row, col)
+ call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm')
+ endfunc
+
func MouseLeftDrag(row, col)
call TerminalEscapeCode(0x43, 0x20, a:row, a:col, 'M')
endfunc
***************
*** 42,48 ****
call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M')
endfunc
! func Test_xterm_mouse_click()
new
let save_mouse = &mouse
let save_term = &term
--- 50,56 ----
call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M')
endfunc
! func Test_xterm_mouse_left_click()
new
let save_mouse = &mouse
let save_term = &term
***************
*** 68,73 ****
--- 76,123 ----
bwipe!
endfunc
+ func Test_xterm_mouse_middle_click()
+ new
+ let save_mouse = &mouse
+ let save_term = &term
+ let save_ttymouse = &ttymouse
+ let save_quotestar = @*
+ let @* = 'abc'
+ set mouse=a term=xterm
+
+ for ttymouse_val in ['xterm2', 'sgr']
+ let msg = 'ttymouse=' .. ttymouse_val
+ exe 'set ttymouse=' . ttymouse_val
+ call setline(1, ['123456789', '123456789'])
+
+ " Middle-click in the middle of the line pastes text where clicked.
+ let row = 1
+ let col = 6
+ call MouseMiddleClick(row, col)
+ call MouseMiddleRelease(row, col)
+ call assert_equal(['12345abc6789', '123456789'], getline(1, '$'), msg)
+
+ " Middle-click beyond end of the line pastes text at the end of the line.
+ let col = 20
+ call MouseMiddleClick(row, col)
+ call MouseMiddleRelease(row, col)
+ call assert_equal(['12345abc6789abc', '123456789'], getline(1, '$'), msg)
+
+ " Middle-click beyond the last line pastes in the last line.
+ let row = 5
+ let col = 3
+ call MouseMiddleClick(row, col)
+ call MouseMiddleRelease(row, col)
+ call assert_equal(['12345abc6789abc', '12abc3456789'], getline(1, '$'), msg)
+ endfor
+
+ let &mouse = save_mouse
+ let &term = save_term
+ let &ttymouse = save_ttymouse
+ let @* = save_quotestar
+ bwipe!
+ endfunc
+
func Test_xterm_mouse_wheel()
new
let save_mouse = &mouse
*** ../vim-8.1.1215/src/version.c 2019-04-27 18:32:27.821786738 +0200
--- src/version.c 2019-04-27 19:10:36.410304033 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1216,
/**/
--
ARTHUR: Well, I AM king...
DENNIS: Oh king, eh, very nice. An' how'd you get that, eh? By exploitin'
the workers -- by 'angin' on to outdated imperialist dogma which
perpetuates the economic an' social differences in our society! If
there's ever going to be any progress--
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|