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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1167
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.1167
Problem: No test for closing tab by click in tabline.
Solution: Add a test. Also fix that dragging window separator could fail in
a large terminal. (Dominique Pelle, closes #4253)
Files: src/testdir/test_termcodes.vim
*** ../vim-8.1.1166/src/testdir/test_termcodes.vim 2019-04-13 14:53:10.886456655 +0200
--- src/testdir/test_termcodes.vim 2019-04-13 22:10:53.844130253 +0200
***************
*** 119,158 ****
let row = rowseparator
let col = 1
! if ttymouse_val ==# 'xterm' && row > 223
! " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported.
! continue
endif
-
- call MouseLeftClick(row, col)
-
- let row -= 1
- call MouseLeftDrag(row, col)
- call assert_equal(rowseparator - 1, winheight(0) + 1)
- let row += 1
- call MouseLeftDrag(row, col)
- call assert_equal(rowseparator, winheight(0) + 1)
- call MouseLeftRelease(row, col)
- call assert_equal(rowseparator, winheight(0) + 1)
-
bwipe!
" Split vertically and test dragging the vertical window separator.
vsplit
let colseparator = winwidth(0) + 1
-
let row = 1
let col = colseparator
- call MouseLeftClick(row, col)
- let col -= 1
- call MouseLeftDrag(row, col)
- call assert_equal(colseparator - 1, winwidth(0) + 1)
- let col += 1
- call MouseLeftDrag(row, col)
- call assert_equal(colseparator, winwidth(0) + 1)
- call MouseLeftRelease(row, col)
- call assert_equal(colseparator, winwidth(0) + 1)
bwipe!
endfor
--- 119,156 ----
let row = rowseparator
let col = 1
! " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported.
! if ttymouse_val !=# 'xterm' || row <= 223
! call MouseLeftClick(row, col)
! let row -= 1
! call MouseLeftDrag(row, col)
! call assert_equal(rowseparator - 1, winheight(0) + 1)
! let row += 1
! call MouseLeftDrag(row, col)
! call assert_equal(rowseparator, winheight(0) + 1)
! call MouseLeftRelease(row, col)
! call assert_equal(rowseparator, winheight(0) + 1)
endif
bwipe!
" Split vertically and test dragging the vertical window separator.
vsplit
let colseparator = winwidth(0) + 1
let row = 1
let col = colseparator
+ " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported.
+ if ttymouse_val !=# 'xterm' || col <= 223
+ call MouseLeftClick(row, col)
+ let col -= 1
+ call MouseLeftDrag(row, col)
+ call assert_equal(colseparator - 1, winwidth(0) + 1)
+ let col += 1
+ call MouseLeftDrag(row, col)
+ call assert_equal(colseparator, winwidth(0) + 1)
+ call MouseLeftRelease(row, col)
+ call assert_equal(colseparator, winwidth(0) + 1)
+ endif
bwipe!
endfor
***************
*** 221,227 ****
" Test clicking on tab names in the tabline at the top.
let col = 2
! redraw!
call MouseLeftClick(row, col)
call MouseLeftRelease(row, col)
let a = split(execute(':tabs'), "\n")
--- 219,225 ----
" Test clicking on tab names in the tabline at the top.
let col = 2
! redraw
call MouseLeftClick(row, col)
call MouseLeftRelease(row, col)
let a = split(execute(':tabs'), "\n")
***************
*** 241,246 ****
--- 239,289 ----
%bwipe!
endfor
+
+ let &mouse = save_mouse
+ let &term = save_term
+ let &ttymouse = save_ttymouse
+ endfunc
+
+ func Test_xterm_mouse_click_X_to_close_tab()
+ let save_mouse = &mouse
+ let save_term = &term
+ let save_ttymouse = &ttymouse
+ set mouse=a term=xterm
+ let row = 1
+ let col = &columns
+
+ for ttymouse_val in ['xterm', 'sgr']
+ if ttymouse_val ==# 'xterm' && col > 223
+ " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported.
+ continue
+ endif
+ exe 'set ttymouse=' . ttymouse_val
+ e Xtab1
+ tabnew Xtab2
+ tabnew Xtab3
+ tabn 2
+
+ let a = split(execute(':tabs'), "\n")
+ call assert_equal(['Tab page 1',
+ \ ' Xtab1',
+ \ 'Tab page 2',
+ \ '> Xtab2',
+ \ 'Tab page 3',
+ \ ' Xtab3'], a)
+
+ " Click on "X" in tabline to close current tab i.e. Xtab2.
+ redraw
+ call MouseLeftClick(row, col)
+ call MouseLeftRelease(row, col)
+ let a = split(execute(':tabs'), "\n")
+ call assert_equal(['Tab page 1',
+ \ ' Xtab1',
+ \ 'Tab page 2',
+ \ '> Xtab3'], a)
+
+ %bwipe!
+ endfor
let &mouse = save_mouse
let &term = save_term
*** ../vim-8.1.1166/src/version.c 2019-04-13 20:38:53.745034749 +0200
--- src/version.c 2019-04-13 22:12:41.423186715 +0200
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1167,
/**/
--
Women are probably the main cause of free software starvation.
/// 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 ///
|