blob: a99753ef1eba631dd481d987924563ab68cbac17 [file] [log] [blame]
Bram Moolenaar1381d792016-08-18 22:11:42 +02001" Tests for tabpage
2
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +02003source screendump.vim
Bram Moolenaardbe88692018-05-20 14:57:22 +02004
Bram Moolenaar1381d792016-08-18 22:11:42 +02005function Test_tabpage()
Bram Moolenaar5a4c3082019-12-01 15:23:11 +01006 CheckFeature quickfix
7
Bram Moolenaar1381d792016-08-18 22:11:42 +02008 bw!
9 " Simple test for opening and closing a tab page
10 tabnew
11 call assert_equal(2, tabpagenr())
12 quit
13
14 " Open three tab pages and use ":tabdo"
15 0tabnew
16 1tabnew
17 $tabnew
Bram Moolenaar3e8474d2016-10-12 17:52:42 +020018 %del
Bram Moolenaar1381d792016-08-18 22:11:42 +020019 tabdo call append(line('$'), tabpagenr())
20 tabclose! 2
21 tabrewind
22 let line1 = getline('$')
23 undo
24 q
25 tablast
26 let line2 = getline('$')
27 q!
28 call append(line('$'), line1)
29 call append(line('$'), line2)
30 unlet line1 line2
31 call assert_equal(['', '3', '1', '4'], getline(1, '$'))
32 "
33 " Test for settabvar() and gettabvar() functions. Open a new tab page and
34 " set 3 variables to a number, string and a list. Verify that the variables
35 " are correctly set.
36 tabnew
37 tabfirst
38 call settabvar(2, 'val_num', 100)
Bram Moolenaaraad222c2019-09-06 22:46:09 +020039 eval 'SetTabVar test'->settabvar(2, 'val_str')
Bram Moolenaar1381d792016-08-18 22:11:42 +020040 call settabvar(2, 'val_list', ['red', 'blue', 'green'])
41 "
42 call assert_true(gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green'])
43
44 tabnext 2
45 call assert_true(t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green'])
46 tabclose
47
Bram Moolenaar5a656862018-02-12 22:08:06 +010048 " Test for ":tab drop exist-file" to keep current window.
49 sp test1
50 tab drop test1
51 call assert_true(tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1)
52 close
53 "
54 "
55 " Test for ":tab drop new-file" to keep current window of tabpage 1.
56 split
57 tab drop newfile
58 call assert_true(tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1)
59 tabclose
60 q
61 "
62 "
Bram Moolenaar1bc353b2019-09-01 14:45:28 +020063 " Test for ":tab drop multi-opened-file" to keep current tabpage and window.
Bram Moolenaar5a656862018-02-12 22:08:06 +010064 new test1
65 tabnew
66 new test1
67 tab drop test1
68 call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1)
69 tabclose
70 q
71 "
72 "
73 " Test for ":tab drop vertical-split-window" to jump test1 buffer
74 tabedit test1
75 vnew
76 tabfirst
77 tab drop test1
78 call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)])
79 1tabonly
Bram Moolenaar1381d792016-08-18 22:11:42 +020080 "
81 "
82 for i in range(9) | tabnew | endfor
83 normal! 1gt
84 call assert_equal(1, tabpagenr())
85 tabmove 5
86 call assert_equal(5, tabpagenr())
87 .tabmove
88 call assert_equal(5, tabpagenr())
89 tabmove -
90 call assert_equal(4, tabpagenr())
91 tabmove +
92 call assert_equal(5, tabpagenr())
93 tabmove -2
94 call assert_equal(3, tabpagenr())
95 tabmove +4
96 call assert_equal(7, tabpagenr())
97 tabmove
98 call assert_equal(10, tabpagenr())
Bram Moolenaar1381d792016-08-18 22:11:42 +020099 0tabmove
100 call assert_equal(1, tabpagenr())
101 $tabmove
102 call assert_equal(10, tabpagenr())
103 tabmove 0
104 call assert_equal(1, tabpagenr())
105 tabmove $
106 call assert_equal(10, tabpagenr())
107 3tabmove
108 call assert_equal(4, tabpagenr())
109 7tabmove 5
110 call assert_equal(5, tabpagenr())
Bram Moolenaar82a12462019-01-22 22:41:42 +0100111 -tabmove
112 call assert_equal(4, tabpagenr())
113 +tabmove
114 call assert_equal(5, tabpagenr())
115 -2tabmove
116 call assert_equal(3, tabpagenr())
117 +3tabmove
118 call assert_equal(6, tabpagenr())
zeertzjq076faac2024-03-25 16:41:06 +0100119 silent -tabmove
120 call assert_equal(5, tabpagenr())
121 silent -2 tabmove
122 call assert_equal(3, tabpagenr())
123 silent -2 tabmove
124 call assert_equal(1, tabpagenr())
Bram Moolenaar7cc59652018-08-07 13:14:46 +0200125
Bram Moolenaar7cc59652018-08-07 13:14:46 +0200126 norm! 2gt
127 call assert_equal(2, tabpagenr())
zeertzjq076faac2024-03-25 16:41:06 +0100128 " The following are a no-op
Bram Moolenaar7cc59652018-08-07 13:14:46 +0200129 tabmove 2
130 call assert_equal(2, tabpagenr())
131 2tabmove
132 call assert_equal(2, tabpagenr())
133 tabmove 1
134 call assert_equal(2, tabpagenr())
135 1tabmove
136 call assert_equal(2, tabpagenr())
137
Bram Moolenaar62a23252020-08-09 14:04:42 +0200138 call assert_fails('let t = tabpagenr("@")', 'E15:')
Bram Moolenaar92b83cc2020-04-25 15:24:44 +0200139 call assert_equal(0, tabpagewinnr(-1))
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100140 call assert_fails("99tabmove", 'E16:')
141 call assert_fails("+99tabmove", 'E16:')
142 call assert_fails("-99tabmove", 'E16:')
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200143 call assert_fails("tabmove foo", 'E475:')
144 call assert_fails("tabmove 99", 'E475:')
145 call assert_fails("tabmove +99", 'E475:')
146 call assert_fails("tabmove -99", 'E475:')
147 call assert_fails("tabmove -3+", 'E475:')
148 call assert_fails("tabmove $3", 'E475:')
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100149 call assert_fails("%tabonly", 'E16:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100150 1tabonly!
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200151 tabmove 1
152 call assert_equal(1, tabpagenr())
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100153 tabnew
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200154 call assert_fails("-2tabmove", 'E16:')
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100155 tabonly!
Bram Moolenaar1381d792016-08-18 22:11:42 +0200156endfunc
157
Bram Moolenaar8281a162023-04-20 18:07:57 +0100158func Test_tabpage_drop()
159 edit f1
160 tab split f2
161 tab split f3
162 normal! gt
163 call assert_equal(1, tabpagenr())
glepnir2975a542024-02-09 19:30:26 +0100164 tab drop f4
165 call assert_equal(1, tabpagenr('#'))
Bram Moolenaar8281a162023-04-20 18:07:57 +0100166
167 tab drop f3
glepnir2975a542024-02-09 19:30:26 +0100168 call assert_equal(4, tabpagenr())
169 call assert_equal(2, tabpagenr('#'))
170 bwipe!
Bram Moolenaar8281a162023-04-20 18:07:57 +0100171 bwipe!
172 bwipe!
173 bwipe!
174 call assert_equal(1, tabpagenr('$'))
Rocco Maof96dc8d2024-01-23 21:27:19 +0100175
176 call assert_equal(1, winnr('$'))
177 call assert_equal('', bufname(''))
178 call writefile(['L1', 'L2'], 'Xdropfile', 'D')
179
180 " Test for ':tab drop single-file': reuse current buffer
181 let expected_nr = bufnr()
182 tab drop Xdropfile
183 call assert_equal(1, tabpagenr('$'))
184 call assert_equal(expected_nr, bufnr())
185 call assert_equal('L2', getline(2))
186 bwipe!
187
188 " Test for ':tab drop single-file': not reuse modified buffer
189 set modified
190 let expected_nr = bufnr() + 1
191 tab drop Xdropfile
192 call assert_equal(2, tabpagenr())
193 call assert_equal(2, tabpagenr('$'))
194 call assert_equal(expected_nr, bufnr())
195 call assert_equal('L2', getline(2))
196 bwipe!
197
198 " Test for ':tab drop single-file': multiple tabs already exist
199 tab split f2
200 tab split f3
201 let expected_nr = bufnr() + 1
202 tab drop Xdropfile
203 call assert_equal(4, tabpagenr())
204 call assert_equal(4, tabpagenr('$'))
205 call assert_equal(expected_nr, bufnr())
206 call assert_equal('L2', getline(2))
207 %bwipe!
208
209 " Test for ':tab drop multi-files': reuse current buffer
210 let expected_nr = bufnr()
211 tab drop Xdropfile f1 f2 f3
212 call assert_equal(1, tabpagenr())
213 call assert_equal(4, tabpagenr('$'))
214 call assert_equal(expected_nr, bufnr())
215 call assert_equal('L2', getline(2))
216 %bwipe!
217
218 " Test for ':tab drop multi-files': not reuse modified buffer
219 set modified
220 let expected_nr = bufnr() + 1
221 tab drop Xdropfile f1 f2 f3
222 call assert_equal(2, tabpagenr())
223 call assert_equal(5, tabpagenr('$'))
224 call assert_equal(expected_nr, bufnr())
225 call assert_equal('L2', getline(2))
226 %bwipe!
227
228 " Test for ':tab drop multi-files': multiple tabs already exist
229 tab split f2
230 tab split f3
231 let expected_nr = bufnr() + 1
232 tab drop a b c
233 call assert_equal(4, tabpagenr())
234 call assert_equal(6, tabpagenr('$'))
235 call assert_equal(expected_nr, bufnr())
236 let expected_nr = bufnr() + 3
237 tab drop Xdropfile f1 f2 f3
238 call assert_equal(5, tabpagenr())
239 call assert_equal(8, tabpagenr('$'))
240 call assert_equal(expected_nr, bufnr())
241 call assert_equal('L2', getline(2))
242 %bwipe!
Bram Moolenaar8281a162023-04-20 18:07:57 +0100243endfunc
244
Bram Moolenaar1381d792016-08-18 22:11:42 +0200245" Test autocommands
246function Test_tabpage_with_autocmd()
Bram Moolenaar1381d792016-08-18 22:11:42 +0200247 command -nargs=1 -bar C :call add(s:li, '=== ' . <q-args> . ' ===')|<args>
248 augroup TestTabpageGroup
249 au!
250 autocmd TabEnter * call add(s:li, 'TabEnter')
251 autocmd WinEnter * call add(s:li, 'WinEnter')
252 autocmd BufEnter * call add(s:li, 'BufEnter')
253 autocmd TabLeave * call add(s:li, 'TabLeave')
254 autocmd WinLeave * call add(s:li, 'WinLeave')
255 autocmd BufLeave * call add(s:li, 'BufLeave')
256 augroup END
257
258 let s:li = []
259 let t:a='a'
260 C tab split
261 call assert_equal(['=== tab split ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter'], s:li)
262 let s:li = []
263 let t:a='b'
264 C tabnew
265 call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li)
266 let t:a='c'
267 let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+')
268 call assert_equal(['a', 'b', 'c'], s:li)
269
270 let s:li = []
271 C call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)')
272 call assert_equal(["=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') ==="], s:li)
273 let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+')
274 call assert_equal(['2', '4', '6'], s:li)
275
276 let s:li = []
277 let w:a='a'
278 C vsplit
279 call assert_equal(['=== vsplit ===', 'WinLeave', 'WinEnter'], s:li)
280 let s:li = []
281 let w:a='a'
282 let tabn=tabpagenr()
283 let winr=range(1, winnr('$'))
284 C tabnext 1
285 call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li)
286 let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+')
287 call assert_equal(['a', 'a'], s:li)
288 let s:li = []
Bram Moolenaaraad222c2019-09-06 22:46:09 +0200289 C call map(copy(winr), '(v:val*2)->settabwinvar(' .. tabn .. ', v:val, ''a'')')
Bram Moolenaar1381d792016-08-18 22:11:42 +0200290 let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+')
291 call assert_equal(['2', '4'], s:li)
292
293 augroup TabDestructive
294 autocmd TabEnter * :C tabnext 2 | C tabclose 3
295 augroup END
296 let s:li = []
297 C tabnext 3
298 call assert_equal(['=== tabnext 3 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li)
299 call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')])
300
301 autocmd! TabDestructive TabEnter
302 let s:li = []
303 C tabnew
304 call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li)
305 let s:li = []
306 C tabnext 1
307 call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li)
308
309 autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3
310 let s:li = []
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100311 call assert_equal(3, tabpagenr('$'))
312 C tabnext 2
313 call assert_equal(2, tabpagenr('$'))
314 call assert_equal(['=== tabnext 2 ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li)
Bram Moolenaar1381d792016-08-18 22:11:42 +0200315 call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')])
316
317 delcommand C
318 autocmd! TabDestructive
319 augroup! TabDestructive
320 autocmd! TestTabpageGroup
321 augroup! TestTabpageGroup
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100322 1tabonly!
Bram Moolenaar1381d792016-08-18 22:11:42 +0200323endfunction
324
Bram Moolenaarc10b5212020-01-13 20:54:51 +0100325" Test autocommands on tab drop
326function Test_tabpage_with_autocmd_tab_drop()
327 augroup TestTabpageGroup
328 au!
329 autocmd TabEnter * call add(s:li, 'TabEnter')
330 autocmd WinEnter * call add(s:li, 'WinEnter')
331 autocmd BufEnter * call add(s:li, 'BufEnter')
332 autocmd TabLeave * call add(s:li, 'TabLeave')
333 autocmd WinLeave * call add(s:li, 'WinLeave')
334 autocmd BufLeave * call add(s:li, 'BufLeave')
335 augroup END
336
337 let s:li = []
338 tab drop test1
Rocco Maof96dc8d2024-01-23 21:27:19 +0100339 call assert_equal(['BufEnter'], s:li)
Bram Moolenaarc10b5212020-01-13 20:54:51 +0100340
341 let s:li = []
342 tab drop test2 test3
343 call assert_equal([
344 \ 'TabLeave', 'TabEnter', 'TabLeave', 'TabEnter',
345 \ 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter',
Rocco Maof96dc8d2024-01-23 21:27:19 +0100346 \ 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter', 'BufEnter'], s:li)
Bram Moolenaarc10b5212020-01-13 20:54:51 +0100347
348 autocmd! TestTabpageGroup
349 augroup! TestTabpageGroup
350 1tabonly!
351endfunction
352
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200353function Test_tabpage_with_tab_modifier()
Bram Moolenaar5a4c3082019-12-01 15:23:11 +0100354 CheckFeature quickfix
355
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200356 for n in range(4)
357 tabedit
358 endfor
359
360 function s:check_tab(pre_nr, cmd, post_nr)
361 exec 'tabnext ' . a:pre_nr
362 exec a:cmd
363 call assert_equal(a:post_nr, tabpagenr())
Bram Moolenaar100f5c92016-09-06 21:33:52 +0200364 call assert_equal('help', &buftype)
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200365 helpclose
366 endfunc
367
368 call s:check_tab(1, 'tab help', 2)
369 call s:check_tab(1, '3tab help', 4)
370 call s:check_tab(1, '.tab help', 2)
371 call s:check_tab(1, '.+1tab help', 3)
372 call s:check_tab(1, '0tab help', 1)
373 call s:check_tab(2, '+tab help', 4)
374 call s:check_tab(2, '+2tab help', 5)
375 call s:check_tab(4, '-tab help', 4)
376 call s:check_tab(4, '-2tab help', 3)
377 call s:check_tab(3, '$tab help', 6)
378 call assert_fails('99tab help', 'E16:')
379 call assert_fails('+99tab help', 'E16:')
380 call assert_fails('-99tab help', 'E16:')
381
382 delfunction s:check_tab
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100383 1tabonly!
384endfunction
385
386function Check_tab_count(pre_nr, cmd, post_nr)
387 exec 'tabnext' a:pre_nr
388 normal! G
389 exec a:cmd
390 call assert_equal(a:post_nr, tabpagenr(), a:cmd)
391endfunc
392
393" Test for [count] of tabnext
394function Test_tabpage_with_tabnext()
395 for n in range(4)
396 tabedit
397 call setline(1, ['', '', '3'])
398 endfor
399
400 call Check_tab_count(1, 'tabnext', 2)
401 call Check_tab_count(1, '3tabnext', 3)
402 call Check_tab_count(1, '.tabnext', 1)
403 call Check_tab_count(1, '.+1tabnext', 2)
404 call Check_tab_count(2, '+tabnext', 3)
405 call Check_tab_count(2, '+2tabnext', 4)
406 call Check_tab_count(4, '-tabnext', 3)
407 call Check_tab_count(4, '-2tabnext', 2)
408 call Check_tab_count(3, '$tabnext', 5)
409 call assert_fails('0tabnext', 'E16:')
410 call assert_fails('99tabnext', 'E16:')
411 call assert_fails('+99tabnext', 'E16:')
412 call assert_fails('-99tabnext', 'E16:')
413 call Check_tab_count(1, 'tabnext 3', 3)
414 call Check_tab_count(2, 'tabnext +', 3)
415 call Check_tab_count(2, 'tabnext +2', 4)
416 call Check_tab_count(4, 'tabnext -', 3)
417 call Check_tab_count(4, 'tabnext -2', 2)
418 call Check_tab_count(3, 'tabnext $', 5)
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200419 call assert_fails('tabnext 0', 'E475:')
420 call assert_fails('tabnext .', 'E475:')
421 call assert_fails('tabnext -+', 'E475:')
422 call assert_fails('tabnext +2-', 'E475:')
423 call assert_fails('tabnext $3', 'E475:')
424 call assert_fails('tabnext 99', 'E475:')
425 call assert_fails('tabnext +99', 'E475:')
426 call assert_fails('tabnext -99', 'E475:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100427
428 1tabonly!
429endfunction
430
431" Test for [count] of tabprevious
432function Test_tabpage_with_tabprevious()
433 for n in range(5)
434 tabedit
435 call setline(1, ['', '', '3'])
436 endfor
437
438 for cmd in ['tabNext', 'tabprevious']
439 call Check_tab_count(6, cmd, 5)
440 call Check_tab_count(6, '3' . cmd, 3)
441 call Check_tab_count(6, '8' . cmd, 4)
442 call Check_tab_count(6, cmd . ' 3', 3)
443 call Check_tab_count(6, cmd . ' 8', 4)
444 for n in range(2)
Bram Moolenaar9d489562020-07-30 20:08:50 +0200445 for c in ['0', '.+3', '+', '+2', '-', '-2', '$', '+99', '-99']
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100446 if n == 0 " pre count
447 let entire_cmd = c . cmd
448 let err_code = 'E16:'
449 else
450 let entire_cmd = cmd . ' ' . c
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200451 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100452 endif
453 call assert_fails(entire_cmd, err_code)
454 endfor
455 endfor
456 endfor
457
458 1tabonly!
459endfunction
460
461function s:reconstruct_tabpage_for_test(nr)
462 let n = (a:nr > 2) ? a:nr - 2 : 1
463 1tabonly!
464 0tabedit n0
465 for n in range(1, n)
466 exec '$tabedit n' . n
467 if n == 1
468 call setline(1, ['', '', '3'])
469 endif
470 endfor
471endfunc
472
Bram Moolenaardbe88692018-05-20 14:57:22 +0200473func Test_tabpage_ctrl_pgup_pgdown()
474 enew!
475 tabnew tab1
476 tabnew tab2
477
478 call assert_equal(3, tabpagenr())
479 exe "norm! \<C-PageUp>"
480 call assert_equal(2, tabpagenr())
481 exe "norm! \<C-PageDown>"
482 call assert_equal(3, tabpagenr())
483
484 " Check wrapping at last or first page.
485 exe "norm! \<C-PageDown>"
486 call assert_equal(1, tabpagenr())
487 exe "norm! \<C-PageUp>"
488 call assert_equal(3, tabpagenr())
489
490 " With a count, <C-PageUp> and <C-PageDown> are not symmetrical somehow:
491 " - {count}<C-PageUp> goes {count} pages downward (relative count)
492 " - {count}<C-PageDown> goes to page number {count} (absolute count)
493 exe "norm! 2\<C-PageUp>"
494 call assert_equal(1, tabpagenr())
495 exe "norm! 2\<C-PageDown>"
496 call assert_equal(2, tabpagenr())
497
498 1tabonly!
499endfunc
500
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100501" Test for [count] of tabclose
502function Test_tabpage_with_tabclose()
503
504 " pre count
505 call s:reconstruct_tabpage_for_test(6)
506 call Check_tab_count(3, 'tabclose!', 3)
507 call Check_tab_count(1, '3tabclose', 1)
508 call Check_tab_count(4, '4tabclose', 3)
509 call Check_tab_count(3, '1tabclose', 2)
510 call Check_tab_count(2, 'tabclose', 1)
511 call assert_equal(1, tabpagenr('$'))
512 call assert_equal('', bufname(''))
513
514 call s:reconstruct_tabpage_for_test(6)
515 call Check_tab_count(2, '$tabclose', 2)
516 call Check_tab_count(4, '.tabclose', 4)
517 call Check_tab_count(3, '.+tabclose', 3)
518 call Check_tab_count(3, '.-2tabclose', 2)
519 call Check_tab_count(1, '.+1tabclose!', 1)
520 call assert_equal(1, tabpagenr('$'))
521 call assert_equal('', bufname(''))
522
523 " post count
524 call s:reconstruct_tabpage_for_test(6)
525 call Check_tab_count(3, 'tabclose!', 3)
526 call Check_tab_count(1, 'tabclose 3', 1)
527 call Check_tab_count(4, 'tabclose 4', 3)
528 call Check_tab_count(3, 'tabclose 1', 2)
529 call Check_tab_count(2, 'tabclose', 1)
530 call assert_equal(1, tabpagenr('$'))
531 call assert_equal('', bufname(''))
532
533 call s:reconstruct_tabpage_for_test(6)
534 call Check_tab_count(2, 'tabclose $', 2)
535 call Check_tab_count(4, 'tabclose', 4)
536 call Check_tab_count(3, 'tabclose +', 3)
537 call Check_tab_count(3, 'tabclose -2', 2)
538 call Check_tab_count(1, 'tabclose! +1', 1)
539 call assert_equal(1, tabpagenr('$'))
540 call assert_equal('', bufname(''))
541
542 call s:reconstruct_tabpage_for_test(6)
543 for n in range(2)
544 for c in ['0', '$3', '99', '+99', '-99']
545 if n == 0 " pre count
546 let entire_cmd = c . 'tabclose'
547 let err_code = 'E16:'
548 else
549 let entire_cmd = 'tabclose ' . c
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200550 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100551 endif
552 call assert_fails(entire_cmd, err_code)
553 call assert_equal(6, tabpagenr('$'))
554 endfor
555 endfor
556
557 call assert_fails('3tabclose', 'E37:')
558 call assert_fails('tabclose 3', 'E37:')
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200559 call assert_fails('tabclose -+', 'E475:')
560 call assert_fails('tabclose +2-', 'E475:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100561 call assert_equal(6, tabpagenr('$'))
562
563 1tabonly!
564endfunction
565
566" Test for [count] of tabonly
567function Test_tabpage_with_tabonly()
568
569 " Test for the normal behavior (pre count only)
570 let tc = [ [4, '.', '!'], [2, '.+', ''], [3, '.-2', '!'], [1, '.+1', '!'] ]
571 for c in tc
572 call s:reconstruct_tabpage_for_test(6)
573 let entire_cmd = c[1] . 'tabonly' . c[2]
574 call Check_tab_count(c[0], entire_cmd, 1)
575 call assert_equal(1, tabpagenr('$'))
576 endfor
577
578 " Test for the normal behavior
579 let tc2 = [ [3, '', ''], [1, '3', ''], [4, '4', '!'], [3, '1', '!'],
580 \ [2, '', '!'],
581 \ [2, '$', '!'], [3, '+', '!'], [3, '-2', '!'], [3, '+1', '!']
582 \ ]
583 for n in range(2)
584 for c in tc2
585 call s:reconstruct_tabpage_for_test(6)
586 if n == 0 " pre count
587 let entire_cmd = c[1] . 'tabonly' . c[2]
588 else
589 let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
590 endif
591 call Check_tab_count(c[0], entire_cmd, 1)
592 call assert_equal(1, tabpagenr('$'))
593 endfor
594 endfor
595
596 " Test for the error behavior
597 for n in range(2)
598 for c in ['0', '$3', '99', '+99', '-99']
599 call s:reconstruct_tabpage_for_test(6)
600 if n == 0 " pre count
601 let entire_cmd = c . 'tabonly'
602 let err_code = 'E16:'
603 else
604 let entire_cmd = 'tabonly ' . c
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200605 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100606 endif
607 call assert_fails(entire_cmd, err_code)
608 call assert_equal(6, tabpagenr('$'))
609 endfor
610 endfor
611
612 " Test for the error behavior (post count only)
613 for c in tc
614 call s:reconstruct_tabpage_for_test(6)
615 let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200616 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100617 call assert_fails(entire_cmd, err_code)
618 call assert_equal(6, tabpagenr('$'))
619 endfor
620
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200621 call assert_fails('tabonly -+', 'E475:')
622 call assert_fails('tabonly +2-', 'E475:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100623 call assert_equal(6, tabpagenr('$'))
624
625 1tabonly!
626 new
627 only!
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200628endfunction
629
Bram Moolenaar5a497892016-09-03 16:29:04 +0200630func Test_tabnext_on_buf_unload1()
Bram Moolenaar11fbc282016-09-02 21:48:32 +0200631 " This once caused a crash
632 new
633 tabedit
634 tabfirst
635 au BufUnload <buffer> tabnext
636 q
637
638 while tabpagenr('$') > 1
Bram Moolenaar5a497892016-09-03 16:29:04 +0200639 bwipe!
640 endwhile
641endfunc
642
643func Test_tabnext_on_buf_unload2()
644 " This once caused a crash
645 tabedit
646 autocmd BufUnload <buffer> tabnext
647 file x
648 edit y
649
650 while tabpagenr('$') > 1
651 bwipe!
Bram Moolenaar11fbc282016-09-02 21:48:32 +0200652 endwhile
653endfunc
654
Bram Moolenaar0ea50702017-07-08 14:44:50 +0200655func Test_close_on_quitpre()
656 " This once caused a crash
Bram Moolenaarce11de82017-10-26 22:00:00 +0200657 edit Xtest
Bram Moolenaar0ea50702017-07-08 14:44:50 +0200658 new
659 only
660 set bufhidden=delete
661 au QuitPre <buffer> close
662 tabnew tab1
663 tabnew tab2
664 1tabn
665 q!
666 call assert_equal(1, tabpagenr())
667 call assert_equal(2, tabpagenr('$'))
668 " clean up
669 while tabpagenr('$') > 1
670 bwipe!
671 endwhile
Bram Moolenaarce11de82017-10-26 22:00:00 +0200672 buf Xtest
Bram Moolenaar0ea50702017-07-08 14:44:50 +0200673endfunc
Bram Moolenaar11fbc282016-09-02 21:48:32 +0200674
Bram Moolenaardbe88692018-05-20 14:57:22 +0200675func Test_tabs()
676 enew!
677 tabnew tab1
678 norm ixxx
679 let a=split(execute(':tabs'), "\n")
680 call assert_equal(['Tab page 1',
681 \ ' [No Name]',
682 \ 'Tab page 2',
683 \ '> + tab1'], a)
684
685 1tabonly!
686 bw!
687endfunc
688
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200689func Test_tabpage_cmdheight()
Drew Vogelea67ba72025-05-07 22:05:17 +0200690 CheckScreendump
Bram Moolenaar494e9062020-05-31 21:28:02 +0200691 CheckRunVimInTerminal
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200692 call writefile([
693 \ 'set laststatus=2',
694 \ 'set cmdheight=2',
695 \ 'tabnew',
696 \ 'set cmdheight=3',
697 \ 'tabnext',
698 \ 'redraw!',
699 \ 'echo "hello\nthere"',
700 \ 'tabnext',
701 \ 'redraw',
Bram Moolenaarc4860bd2022-10-15 20:52:26 +0100702 \ ], 'XTest_tabpage_cmdheight', 'D')
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200703 " Check that cursor line is concealed
704 let buf = RunVimInTerminal('-S XTest_tabpage_cmdheight', {'statusoff': 3})
705 call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {})
706
707 call StopVimInTerminal(buf)
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200708endfunc
709
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100710" Test for closing the tab page from a command window
711func Test_tabpage_close_cmdwin()
712 tabnew
713 call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt')
714 call assert_equal(2, tabpagenr('$'))
715 call feedkeys("q/:tabonly\<CR>\<Esc>", 'xt')
716 call assert_equal(2, tabpagenr('$'))
717 tabonly
718endfunc
719
Bram Moolenaar845e0ee2020-06-20 16:05:32 +0200720" Pressing <C-PageUp> in insert mode should go to the previous tab page
721" and <C-PageDown> should go to the next tab page
722func Test_tabpage_Ctrl_Pageup()
723 tabnew
724 call feedkeys("i\<C-PageUp>", 'xt')
725 call assert_equal(1, tabpagenr())
726 call feedkeys("i\<C-PageDown>", 'xt')
727 call assert_equal(2, tabpagenr())
728 %bw!
729endfunc
730
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200731" Return the terminal key code for selecting a tab page from the tabline. This
732" sequence contains the following codes: a CSI (0x9b), KS_TABLINE (0xf0),
733" KS_FILLER (0x58) and then the tab page number.
734func TabLineSelectPageCode(tabnr)
735 return "\x9b\xf0\x58" .. nr2char(a:tabnr)
736endfunc
737
738" Return the terminal key code for opening a new tabpage from the tabpage
739" menu. This sequence consists of the following codes: a CSI (0x9b),
740" KS_TABMENU (0xef), KS_FILLER (0x58), the tab page number and
741" TABLINE_MENU_NEW (2).
742func TabMenuNewItemCode(tabnr)
743 return "\x9b\xef\x58" .. nr2char(a:tabnr) .. nr2char(2)
744endfunc
745
746" Return the terminal key code for closing a tabpage from the tabpage menu.
747" This sequence consists of the following codes: a CSI (0x9b), KS_TABMENU
748" (0xef), KS_FILLER (0x58), the tab page number and TABLINE_MENU_CLOSE (1).
749func TabMenuCloseItemCode(tabnr)
750 return "\x9b\xef\x58" .. nr2char(a:tabnr) .. nr2char(1)
751endfunc
752
753" Test for using the tabpage menu from the insert and normal modes
754func Test_tabline_tabmenu()
755 " only works in GUI
756 CheckGui
757
758 %bw!
759 tabnew
760 tabnew
761 call assert_equal(3, tabpagenr())
762
763 " go to tab page 2 in normal mode
764 call feedkeys(TabLineSelectPageCode(2), "Lx!")
765 call assert_equal(2, tabpagenr())
766
767 " close tab page 3 in normal mode
768 call feedkeys(TabMenuCloseItemCode(3), "Lx!")
769 call assert_equal(2, tabpagenr('$'))
770 call assert_equal(2, tabpagenr())
771
772 " open new tab page before tab page 1 in normal mode
773 call feedkeys(TabMenuNewItemCode(1), "Lx!")
774 call assert_equal(1, tabpagenr())
775 call assert_equal(3, tabpagenr('$'))
776
777 " go to tab page 2 in operator-pending mode (should beep)
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200778 call assert_beeps('call feedkeys("c" .. TabLineSelectPageCode(2), "Lx!")')
779 call assert_equal(2, tabpagenr())
780 call assert_equal(3, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200781
782 " open new tab page before tab page 1 in operator-pending mode (should beep)
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200783 call assert_beeps('call feedkeys("c" .. TabMenuNewItemCode(1), "Lx!")')
784 call assert_equal(1, tabpagenr())
785 call assert_equal(4, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200786
787 " open new tab page after tab page 3 in normal mode
788 call feedkeys(TabMenuNewItemCode(4), "Lx!")
789 call assert_equal(4, tabpagenr())
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200790 call assert_equal(5, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200791
792 " go to tab page 2 in insert mode
793 call feedkeys("i" .. TabLineSelectPageCode(2) .. "\<C-C>", "Lx!")
794 call assert_equal(2, tabpagenr())
795
796 " close tab page 2 in insert mode
797 call feedkeys("i" .. TabMenuCloseItemCode(2) .. "\<C-C>", "Lx!")
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200798 call assert_equal(4, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200799
800 " open new tab page before tab page 3 in insert mode
801 call feedkeys("i" .. TabMenuNewItemCode(3) .. "\<C-C>", "Lx!")
802 call assert_equal(3, tabpagenr())
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200803 call assert_equal(5, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200804
805 " open new tab page after tab page 4 in insert mode
806 call feedkeys("i" .. TabMenuNewItemCode(5) .. "\<C-C>", "Lx!")
807 call assert_equal(5, tabpagenr())
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200808 call assert_equal(6, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200809
810 %bw!
811endfunc
812
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200813" Test for changing the current tab page from an autocmd when closing a tab
814" page.
815func Test_tabpage_switchtab_on_close()
816 only
817 tabnew
818 tabnew
819 " Test for BufLeave
820 augroup T1
821 au!
822 au BufLeave * tabfirst
823 augroup END
824 tabclose
825 call assert_equal(1, tabpagenr())
826 augroup T1
827 au!
828 augroup END
829
830 " Test for WinLeave
831 $tabnew
832 augroup T1
833 au!
834 au WinLeave * tabfirst
835 augroup END
836 tabclose
837 call assert_equal(1, tabpagenr())
838 augroup T1
839 au!
840 augroup END
841
842 " Test for TabLeave
843 $tabnew
844 augroup T1
845 au!
846 au TabLeave * tabfirst
847 augroup END
848 tabclose
849 call assert_equal(1, tabpagenr())
850 augroup T1
851 au!
852 augroup END
853 augroup! T1
854 tabonly
855endfunc
856
857" Test for closing the destination tabpage when jumping from one to another.
858func Test_tabpage_close_on_switch()
859 tabnew
860 tabnew
Bram Moolenaarb18b4962022-09-02 21:55:50 +0100861 edit Xtabfile
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200862 augroup T2
863 au!
Bram Moolenaarb18b4962022-09-02 21:55:50 +0100864 au BufLeave Xtabfile 1tabclose
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200865 augroup END
866 tabfirst
867 call assert_equal(2, tabpagenr())
Bram Moolenaarb18b4962022-09-02 21:55:50 +0100868 call assert_equal('Xtabfile', @%)
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200869 augroup T2
870 au!
871 augroup END
872 augroup! T2
873 %bw!
874endfunc
875
Bram Moolenaar62a23252020-08-09 14:04:42 +0200876" Test for jumping to last accessed tabpage
877func Test_lastused_tabpage()
878 tabonly!
879 call assert_equal(0, tabpagenr('#'))
880 call assert_beeps('call feedkeys("g\<Tab>", "xt")')
881 call assert_beeps('call feedkeys("\<C-Tab>", "xt")')
882 call assert_beeps('call feedkeys("\<C-W>g\<Tab>", "xt")')
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200883 call assert_fails('tabnext #', 'E475:')
Bram Moolenaar62a23252020-08-09 14:04:42 +0200884
885 " open four tab pages
886 tabnew
887 tabnew
888 tabnew
889
890 2tabnext
891
892 " Test for g<Tab>
893 call assert_equal(4, tabpagenr('#'))
894 call feedkeys("g\<Tab>", "xt")
895 call assert_equal(4, tabpagenr())
896 call assert_equal(2, tabpagenr('#'))
897
898 " Test for <C-Tab>
899 call feedkeys("\<C-Tab>", "xt")
900 call assert_equal(2, tabpagenr())
901 call assert_equal(4, tabpagenr('#'))
902
903 " Test for <C-W>g<Tab>
904 call feedkeys("\<C-W>g\<Tab>", "xt")
905 call assert_equal(4, tabpagenr())
906 call assert_equal(2, tabpagenr('#'))
907
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200908 " Test for :tabnext #
909 tabnext #
910 call assert_equal(2, tabpagenr())
911 call assert_equal(4, tabpagenr('#'))
912
Bram Moolenaar62a23252020-08-09 14:04:42 +0200913 " Try to jump to a closed tab page
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200914 tabclose #
Bram Moolenaar62a23252020-08-09 14:04:42 +0200915 call assert_equal(0, tabpagenr('#'))
916 call feedkeys("g\<Tab>", "xt")
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200917 call assert_equal(2, tabpagenr())
Bram Moolenaar62a23252020-08-09 14:04:42 +0200918 call feedkeys("\<C-Tab>", "xt")
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200919 call assert_equal(2, tabpagenr())
Bram Moolenaar62a23252020-08-09 14:04:42 +0200920 call feedkeys("\<C-W>g\<Tab>", "xt")
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200921 call assert_equal(2, tabpagenr())
922 call assert_fails('tabnext #', 'E475:')
923 call assert_equal(2, tabpagenr())
Bram Moolenaar62a23252020-08-09 14:04:42 +0200924
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200925 " Test for :tabonly #
926 let wnum = win_getid()
927 $tabnew
928 tabonly #
929 call assert_equal(wnum, win_getid())
930 call assert_equal(1, tabpagenr('$'))
931
932 " Test for :tabmove #
933 tabnew
934 let wnum = win_getid()
935 tabnew
936 tabnew
937 tabnext 2
938 tabmove #
939 call assert_equal(4, tabpagenr())
940 call assert_equal(wnum, win_getid())
941
942 tabonly!
Bram Moolenaar62a23252020-08-09 14:04:42 +0200943endfunc
944
Yegappan Lakshmanan72bb47e2022-04-03 11:22:38 +0100945" Test for tabpage allocation failure
946func Test_tabpage_alloc_failure()
947 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
948 call assert_fails('tabnew', 'E342:')
949
950 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
951 edit Xfile1
952 call assert_fails('tabedit Xfile2', 'E342:')
953 call assert_equal(1, winnr('$'))
954 call assert_equal(1, tabpagenr('$'))
955 call assert_equal('Xfile1', @%)
956
957 new
958 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
959 call assert_fails('wincmd T', 'E342:')
960 bw!
961
962 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
963 call assert_fails('tab split', 'E342:')
964 call assert_equal(2, winnr('$'))
965 call assert_equal(1, tabpagenr('$'))
966endfunc
967
LemonBoy5247b0b2024-07-12 19:30:58 +0200968func Test_tabpage_tabclose()
969 " Default behaviour, move to the right.
970 call s:reconstruct_tabpage_for_test(6)
971 norm! 4gt
972 setl tcl=
973 tabclose
974 call assert_equal("n3", bufname())
975
976 " Move to the left.
977 call s:reconstruct_tabpage_for_test(6)
978 norm! 4gt
979 setl tcl=left
980 tabclose
981 call assert_equal("n1", bufname())
982
983 " Move to the last used tab page.
984 call s:reconstruct_tabpage_for_test(6)
985 norm! 5gt
986 norm! 2gt
987 setl tcl=uselast
988 tabclose
989 call assert_equal("n3", bufname())
990
991 " Same, but the last used tab page is invalid. Move to the right.
992 call s:reconstruct_tabpage_for_test(6)
993 norm! 5gt
994 norm! 3gt
995 setl tcl=uselast
996 tabclose 5
997 tabclose!
998 call assert_equal("n2", bufname())
999
1000 " Same, but the last used tab page is invalid. Move to the left.
1001 call s:reconstruct_tabpage_for_test(6)
1002 norm! 5gt
1003 norm! 3gt
1004 setl tcl=uselast,left
1005 tabclose 5
1006 tabclose!
1007 call assert_equal("n0", bufname())
1008
1009 " Move left when moving right is not possible.
1010 call s:reconstruct_tabpage_for_test(6)
1011 setl tcl=
1012 norm! 6gt
1013 tabclose
1014 call assert_equal("n3", bufname())
1015
1016 " Move right when moving left is not possible.
1017 call s:reconstruct_tabpage_for_test(6)
1018 setl tcl=left
1019 norm! 1gt
1020 tabclose
1021 call assert_equal("n0", bufname())
1022
1023 setl tcl&
1024endfunc
1025
Bram Moolenaar99ad3a82023-02-27 17:18:01 +00001026" this was giving ml_get errors
1027func Test_tabpage_last_line()
1028 enew
1029 call setline(1, repeat(['a'], &lines + 5))
1030 $
1031 tabnew
1032 call setline(1, repeat(['b'], &lines + 20))
1033 $
1034 tabNext
1035 call assert_equal('a', getline('.'))
1036
1037 bwipe!
1038 bwipe!
1039endfunc
1040
Christian Brabandtdf12e392023-12-16 13:55:32 +01001041" this was causing an endless loop
1042func Test_tabpage_drop_tabmove()
1043 augroup TestTabpageTabmove
1044 au!
1045 autocmd! TabEnter * :if tabpagenr() > 1 | tabmove - | endif
1046 augroup end
1047 $tab drop XTab_99.log
1048 $tab drop XTab_98.log
1049 $tab drop XTab_97.log
1050
1051 autocmd! TestTabpageTabmove
1052 augroup! TestTabpageTabmove
1053
1054 " clean up
1055 bwipe!
1056 bwipe!
1057 bwipe!
1058endfunc
1059
zeertzjqb47fbb42024-02-12 22:50:26 +01001060" Test that settabvar() shouldn't change the last accessed tabpage.
1061func Test_lastused_tabpage_settabvar()
1062 tabonly!
1063 tabnew
1064 tabnew
1065 tabnew
1066 call assert_equal(3, tabpagenr('#'))
1067
1068 call settabvar(2, 'myvar', 'tabval')
1069 call assert_equal('tabval', gettabvar(2, 'myvar'))
1070 call assert_equal(3, tabpagenr('#'))
1071
1072 bwipe!
1073 bwipe!
1074 bwipe!
1075endfunc
1076
Bram Moolenaar1381d792016-08-18 22:11:42 +02001077" vim: shiftwidth=2 sts=2 expandtab