blob: 6aaae63ac3bf48c98083a4c70a32b17f93991110 [file] [log] [blame]
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +02001" Tests for tabpanel
2
3source check.vim
4source screendump.vim
5CheckFeature tabpanel
6
Hirohito Higashic659e4a2025-05-16 19:34:34 +02007function s:reset()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +02008 set tabpanel&
9 set tabpanelopt&
10 set showtabpanel&
11endfunc
12
Hirohito Higashic659e4a2025-05-16 19:34:34 +020013function Test_tabpanel_mouse()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +020014 let save_showtabline = &showtabline
15 let save_mouse = &mouse
16 set showtabline=0 mouse=a
17
18 tabnew
19 tabnew
20
21 call test_setmouse(1, 1)
22 call feedkeys("\<LeftMouse>", 'xt')
23 call assert_equal(3, tabpagenr())
24
25 set showtabpanel=2 tabpanelopt=columns:10
26
27 call test_setmouse(1, 1)
28 call feedkeys("\<LeftMouse>", 'xt')
29 call assert_equal(1, tabpagenr())
30 call test_setmouse(2, 1)
31 call feedkeys("\<LeftMouse>", 'xt')
32 call assert_equal(2, tabpagenr())
33 call test_setmouse(3, 1)
34 call feedkeys("\<LeftMouse>", 'xt')
35 call assert_equal(3, tabpagenr())
36
37 call feedkeys("\<LeftMouse>", 'xt')
38 call test_setmouse(2, 3)
39 let pos = getmousepos()
40 call assert_equal(2, pos['winrow'])
41 call assert_equal(0, pos['wincol'])
42 call assert_equal(2, pos['screenrow'])
43 call assert_equal(3, pos['screencol'])
44
45 call test_setmouse(1, 11)
46 call feedkeys("\<LeftMouse>", 'xt')
47 let pos = getmousepos()
48 call assert_equal(1, pos['winrow'])
49 call assert_equal(1, pos['wincol'])
50 call assert_equal(1, pos['screenrow'])
51 call assert_equal(11, pos['screencol'])
52
53 new
54 wincmd x
55
56 call test_setmouse(10, 11)
57 call feedkeys("\<LeftMouse>", 'xt')
58 let pos = getmousepos()
59 call assert_equal(10, pos['winrow'])
60 call assert_equal(1, pos['wincol'])
61 call assert_equal(10, pos['screenrow'])
62 call assert_equal(11, pos['screencol'])
63
64 tabonly!
65 call s:reset()
66 let &mouse = save_mouse
67 let &showtabline = save_showtabline
68endfunc
69
Hirohito Higashic659e4a2025-05-16 19:34:34 +020070function Test_tabpanel_drawing()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +020071 CheckScreendump
72
73 let lines =<< trim END
Hirohito Higashic659e4a2025-05-16 19:34:34 +020074 function MyTabPanel()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +020075 let n = g:actual_curtabpage
76 let hi = n == tabpagenr() ? 'TabLineSel' : 'TabLine'
77 let label = printf("\n%%#%sTabNumber#%d:%%#%s#", hi, n, hi)
78 let label ..= '%1*%f%*'
79 return label
80 endfunction
81 hi User1 ctermfg=12
82
83 set showtabline=0
84 set showtabpanel=0
85 set tabpanelopt=columns:16
86 set tabpanel=
87 silent edit Xtabpanel1
88
89 nnoremap \01 <Cmd>set showtabpanel=2<CR>
90 nnoremap \02 <C-w>v
91 nnoremap \03 <Cmd>call setline(1, ['a', 'b', 'c'])<CR>
92 nnoremap \04 <Cmd>silent tabnew Xtabpanel2<CR><Cmd>call setline(1, ['d', 'e', 'f'])<CR>
93 nnoremap \05 <Cmd>set tabpanel=%!MyTabPanel()<CR>
94 nnoremap \06 <Cmd>set tabpanelopt+=align:right<CR>
95 nnoremap \07 <Cmd>tab terminal NONE<CR><C-w>N
96 nnoremap \08 <Cmd>tabclose!<CR><Cmd>tabclose!<CR>
97 END
98 call writefile(lines, 'XTest_tabpanel', 'D')
99
100 let buf = RunVimInTerminal('-S XTest_tabpanel', {'rows': 6, 'cols': 45})
101
102 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_00', {})
103
104 for i in range(1, 8)
105 let n = printf('%02d', i)
106 call term_sendkeys(buf, '\' .. n)
107 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_' .. n, {})
108 endfor
109
110 call StopVimInTerminal(buf)
111endfunc
112
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200113function Test_tabpanel_drawing_with_popupwin()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200114 CheckScreendump
115
116 let lines =<< trim END
117 set showtabpanel=2
118 set tabpanelopt=columns:20
119 set showtabline=0
120 tabnew
121 setlocal buftype=nofile
122 call setbufline(bufnr(), 1, repeat([repeat('.', &columns - 20)], &lines))
123 highlight TestingForTabPanelPopupwin guibg=#7777ff guifg=#000000
124 for line in [1, &lines]
125 for col in [1, &columns - 20 - 2]
126 call popup_create([
127 \ '@',
128 \ ], {
129 \ 'line': line,
130 \ 'col': col,
131 \ 'border': [],
132 \ 'highlight': 'TestingForTabPanelPopupwin',
133 \ })
134 endfor
135 endfor
136 call cursor(4, 10)
137 call popup_atcursor('atcursor', {
138 \ 'highlight': 'TestingForTabPanelPopupwin',
139 \ })
140 END
141 call writefile(lines, 'XTest_tabpanel_with_popupwin', 'D')
142
143 let buf = RunVimInTerminal('-S XTest_tabpanel_with_popupwin', {'rows': 10, 'cols': 45})
144
145 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_with_popupwin_0', {})
146
147 call StopVimInTerminal(buf)
148endfunc
149
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200150function Test_tabpanel_drawing_fill_tailing()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200151 CheckScreendump
152
153 let lines =<< trim END
154 set showtabpanel=2
155 set tabpanelopt=columns:20
156 set showtabline=0
157 e aaa.txt
158 tabnew
159 e bbb.txt
160 let &tabpanel = "abc"
161 redraw!
162 " Check whether "abc" is cleared
163 let &tabpanel = "\nTOP\n%f\nBOTTOM"
164 END
165 call writefile(lines, 'XTest_tabpanel_fill_tailing', 'D')
166
167 let buf = RunVimInTerminal('-S XTest_tabpanel_fill_tailing', {'rows': 10, 'cols': 45})
168
169 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_fill_tailing_0', {})
170
171 call StopVimInTerminal(buf)
172endfunc
173
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200174function Test_tabpanel_drawing_pum()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200175 CheckScreendump
176
177 let lines =<< trim END
178 set showtabpanel=2
179 set tabpanelopt=columns:20
180 set showtabline=0
181 e aaa.txt
182 tabnew
183 e bbb.txt
184 END
185 call writefile(lines, 'XTest_tabpanel_pum', 'D')
186
187 let buf = RunVimInTerminal('-S XTest_tabpanel_pum', {'rows': 10, 'cols': 45})
188
189 call term_sendkeys(buf, "i\<C-x>\<C-v>")
190 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_pum_0', {})
191
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200192 call term_sendkeys(buf, "\<CR> ab\<C-x>\<C-v>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200193 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_pum_1', {})
194
195 call StopVimInTerminal(buf)
196endfunc
197
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200198function Test_tabpanel_scrolling()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200199 CheckScreendump
200
201 let lines =<< trim END
202 set showtabpanel=2
203 set tabpanelopt=columns:20
204 set showtabline=0
205 set nowrap
206 set number
207 e aaa.txt
208 tabnew
209 e bbb.txt
210 vsplit
211 call setbufline(bufnr(), 1, repeat(['text text text text'], 100))
212 wincmd =
213 END
214 call writefile(lines, 'XTest_tabpanel_scrolling', 'D')
215
216 let buf = RunVimInTerminal('-S XTest_tabpanel_scrolling', {'rows': 10, 'cols': 45})
217 let n = 0
218 for c in ['H', 'J', 'K', 'L']
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200219 call term_sendkeys(buf, ":wincmd " .. c .. "\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200220 call term_sendkeys(buf, "\<C-d>\<C-d>")
221 call term_sendkeys(buf, "r@")
222 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_scrolling_' .. n, {})
223 let n += 1
224 endfor
225
226 call StopVimInTerminal(buf)
227endfunc
228
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200229function Test_tabpanel_many_tabpages()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200230 CheckScreendump
231
232 let lines =<< trim END
233 set showtabpanel=2
234 set tabpanelopt=columns:10
235 set showtabline=0
236 set tabpanel=%{g:actual_curtabpage}:tab
237 execute join(repeat(['tabnew'], 20), ' | ')
238 END
239 call writefile(lines, 'XTest_tabpanel_many_tabpages', 'D')
240
241 let buf = RunVimInTerminal('-S XTest_tabpanel_many_tabpages', {'rows': 10, 'cols': 45})
242 for n in range(0, 3)
243 call term_sendkeys(buf, "gt")
244 call VerifyScreenDump(buf, 'Test_tabpanel_many_tabpages_' .. n, {})
245 endfor
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200246 call term_sendkeys(buf, ":tabnext +10\<CR>")
247 call term_sendkeys(buf, ":tabnext -3\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200248 call VerifyScreenDump(buf, 'Test_tabpanel_many_tabpages_4', {})
249
250 call StopVimInTerminal(buf)
251endfunc
252
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200253function Test_tabpanel_visual()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200254 CheckScreendump
255
256 let lines =<< trim END
257 set showtabpanel=2
258 set tabpanelopt=columns:10
259 set showtabline=0
260 tabnew
261 call setbufline(bufnr(), 1, ['aaa1 bbb1 ccc1 ddd1', 'aaa2 bbb2 ccc2 ddd2', 'aaa3 bbb3 ccc3 ddd3', 'aaa4 bbb4 ccc4 ddd4'])
262 END
263 call writefile(lines, 'XTest_tabpanel_visual', 'D')
264
265 let buf = RunVimInTerminal('-S XTest_tabpanel_visual', {'rows': 10, 'cols': 45})
266 call term_sendkeys(buf, "v2w")
267 call VerifyScreenDump(buf, 'Test_tabpanel_visual_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200268 call term_sendkeys(buf, "\<Esc>0jw")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200269 call term_sendkeys(buf, "v2wge")
270 call VerifyScreenDump(buf, 'Test_tabpanel_visual_1', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200271 call term_sendkeys(buf, "y:echo @\"\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200272 call VerifyScreenDump(buf, 'Test_tabpanel_visual_2', {})
273
274 call StopVimInTerminal(buf)
275endfunc
276
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200277function Test_tabpanel_commandline()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200278 CheckScreendump
279
280 let lines =<< trim END
281 set showtabpanel=2
282 set tabpanelopt=columns:10
283 set showtabline=0
284 tabnew
285 END
286 call writefile(lines, 'XTest_tabpanel_commandline', 'D')
287
288 let buf = RunVimInTerminal('-S XTest_tabpanel_commandline', {'rows': 10, 'cols': 45})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200289 call term_sendkeys(buf, ":ab\<Tab>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200290 call VerifyScreenDump(buf, 'Test_tabpanel_commandline_0', {})
291
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200292 call term_sendkeys(buf, "\<Esc>")
293 call term_sendkeys(buf, ":set wildoptions=pum\<CR>")
294 call term_sendkeys(buf, ":ab\<Tab>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200295 call VerifyScreenDump(buf, 'Test_tabpanel_commandline_1', {})
296
297 call StopVimInTerminal(buf)
298endfunc
299
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200300function Test_tabpanel_tabline_and_tabpanel()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200301 CheckScreendump
302
303 let lines =<< trim END
304 set showtabpanel=2
305 set tabpanelopt=columns:10,vert
306 set fillchars=tpl_vert:│
307 set showtabline=2
308 e aaa.txt
309 tabnew
310 e bbb.txt
311 tabnew
312 e ccc.txt
313 END
314 call writefile(lines, 'XTest_tabpanel_tabline_and_tabpanel', 'D')
315
316 let buf = RunVimInTerminal('-S XTest_tabpanel_tabline_and_tabpanel', {'rows': 10, 'cols': 45})
317 call VerifyScreenDump(buf, 'Test_tabpanel_tabline_and_tabpanel_0', {})
318
319 call StopVimInTerminal(buf)
320endfunc
321
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200322function Test_tabpanel_dont_overflow_into_tabpanel()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200323 CheckScreendump
324
325 let lines =<< trim END
326 set showtabpanel=2
327 set tabpanelopt=columns:10
328 set showtabline=2
329 tabnew
330 call setline(1, repeat('x', 100))
331 set wrap
332 END
333 call writefile(lines, 'XTest_tabpanel_dont_overflow_into_tabpanel', 'D')
334
335 let buf = RunVimInTerminal('-S XTest_tabpanel_dont_overflow_into_tabpanel', {'rows': 10, 'cols': 45})
336 call VerifyScreenDump(buf, 'Test_tabpanel_dont_overflow_into_tabpanel_0', {})
337
338 call StopVimInTerminal(buf)
339endfunc
340
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200341function Test_tabpanel_dont_vert_is_multibytes_left()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200342 CheckScreendump
343
344 let lines =<< trim END
345 set showtabpanel=2
346 set tabpanelopt=columns:10,vert
347 set fillchars=tpl_vert:│
348 set showtabline=2
349 tabnew
350 END
351 call writefile(lines, 'XTest_tabpanel_vert_is_multibyte_lefts', 'D')
352
353 let buf = RunVimInTerminal('-S XTest_tabpanel_vert_is_multibyte_lefts', {'rows': 10, 'cols': 45})
354 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_0', {})
355
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200356 call term_sendkeys(buf, ":set tabpanelopt=columns:1,vert\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200357 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_1', {})
358
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200359 call term_sendkeys(buf, ":set tabpanelopt=columns:10,vert\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200360 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_2', {})
361
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200362 call term_sendkeys(buf, ":set tabpanelopt=columns:2,vert\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200363 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_3', {})
364
365 call StopVimInTerminal(buf)
366endfunc
367
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200368function Test_tabpanel_dont_vert_is_multibytes_right()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200369 CheckScreendump
370
371 let lines =<< trim END
372 set showtabpanel=2
373 set tabpanelopt=align:right,columns:10,vert
374 set fillchars=tpl_vert:│
375 set showtabline=2
376 tabnew
377 END
378 call writefile(lines, 'XTest_tabpanel_vert_is_multibytes_right', 'D')
379
380 let buf = RunVimInTerminal('-S XTest_tabpanel_vert_is_multibytes_right', {'rows': 10, 'cols': 45})
381 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_0', {})
382
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200383 call term_sendkeys(buf, ":set tabpanelopt=align:right,columns:1,vert\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200384 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_1', {})
385
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200386 call term_sendkeys(buf, ":set tabpanelopt=align:right,columns:10,vert\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200387 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_2', {})
388
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200389 call term_sendkeys(buf, ":set tabpanelopt=align:right,columns:2,vert\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200390 call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_3', {})
391
392 call StopVimInTerminal(buf)
393endfunc
394
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200395function Test_tabpanel_eval_tabpanel_statusline_tabline()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200396 CheckScreendump
397
398 let lines =<< trim END
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200399 function Expr()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200400 return "$%=[%f]%=$"
401 endfunction
402 set laststatus=2
403 set showtabline=2
404 set showtabpanel=2
405 set statusline=%!Expr()
406 set tabline=%!Expr()
407 set tabpanel=%!Expr()
408 set tabpanelopt=columns:10,vert
409 set fillchars=tpl_vert:│
410 e aaa
411 tabnew
412 e bbb
413 tabnew
414 e ccc
415 END
416 call writefile(lines, 'XTest_tabpanel_eval_tabpanel_statusline_tabline', 'D')
417
418 let buf = RunVimInTerminal('-S XTest_tabpanel_eval_tabpanel_statusline_tabline', {'rows': 10, 'cols': 45})
419 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_statusline_tabline_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200420 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200421 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_statusline_tabline_1', {})
422
423 call StopVimInTerminal(buf)
424endfunc
425
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200426function Test_tabpanel_noeval_tabpanel_statusline_tabline()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200427 CheckScreendump
428
429 let lines =<< trim END
430 set laststatus=2
431 set showtabline=2
432 set showtabpanel=2
433 set statusline=$%=[%f]%=$
434 set tabline=$%=[%f]%=$
435 set tabpanel=$%=[%f]%=$
436 set tabpanelopt=columns:10,vert
437 set fillchars=tpl_vert:│
438 e aaa
439 tabnew
440 e bbb
441 tabnew
442 e ccc
443 END
444 call writefile(lines, 'XTest_tabpanel_noeval_tabpanel_statusline_tabline', 'D')
445
446 let buf = RunVimInTerminal('-S XTest_tabpanel_noeval_tabpanel_statusline_tabline', {'rows': 10, 'cols': 45})
447 call VerifyScreenDump(buf, 'Test_tabpanel_noeval_tabpanel_statusline_tabline_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200448 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200449 call VerifyScreenDump(buf, 'Test_tabpanel_noeval_tabpanel_statusline_tabline_1', {})
450
451 call StopVimInTerminal(buf)
452endfunc
453
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200454function Test_tabpanel_eval_tabpanel_with_linebreaks()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200455 CheckScreendump
456
457 let lines =<< trim END
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200458 function Expr()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200459 return "top\n$%=[%f]%=$\nbottom"
460 endfunction
461 set showtabpanel=2
462 set tabpanel=%!Expr()
463 set tabpanelopt=columns:10
464 e aaa
465 tabnew
466 e bbb
467 tabnew
468 e ccc
469 END
470 call writefile(lines, 'XTest_tabpanel_eval_tabpanel_with_linebreaks', 'D')
471
472 let buf = RunVimInTerminal('-S XTest_tabpanel_eval_tabpanel_with_linebreaks', {'rows': 10, 'cols': 45})
473 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_with_linebreaks_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200474 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200475 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_with_linebreaks_1', {})
476
477 call StopVimInTerminal(buf)
478endfunc
479
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200480function Test_tabpanel_tabonly()
481 CheckScreendump
482
483 let lines =<< trim END
484 tabnew
485 set showtabpanel=1
486 norm 100oasdf
487 vsplit
488 END
489 call writefile(lines, 'XTest_tabpanel_tabonly', 'D')
490
491 let buf = RunVimInTerminal('-S XTest_tabpanel_tabonly', {'rows': 10, 'cols': 80})
492 call VerifyScreenDump(buf, 'Test_tabpanel_only_0', {})
493 call term_sendkeys(buf, ":tabonly\<CR>")
494 call VerifyScreenDump(buf, 'Test_tabpanel_only_1', {})
495
496 call StopVimInTerminal(buf)
497endfunc
498
Naruhiko Nishino2a1e2532025-05-17 16:19:24 +0200499function Test_tabpanel_equalalways()
500 CheckScreendump
501
502 let lines =<< trim END
503 tabnew
504 set showtabpanel=1
505 set tabpanelopt=columns:20
506 set equalalways
507 split
508 vsplit
509 END
510 call writefile(lines, 'XTest_tabpanel_equalalways', 'D')
511
512 let buf = RunVimInTerminal('-S XTest_tabpanel_equalalways', {'rows': 10, 'cols': 78})
513 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_0', {})
514 call term_sendkeys(buf, ":set tabpanelopt=columns:10\<CR>")
515 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_1', {})
516 call term_sendkeys(buf, ":set tabpanelopt=columns:30\<CR>")
517 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_2', {})
518 call term_sendkeys(buf, ":set tabpanelopt=columns:5\<CR>")
519 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_3', {})
520
521 call StopVimInTerminal(buf)
522endfunc
523
Christian Brabandta88c5bd2025-05-26 19:51:03 +0200524function Test_tabpanel_error()
525 set tabpanel=%!NonExistingFunc()
526 try
527 set showtabpanel=2
528 redraw!
529 catch /^Vim\%((\a\+)\)\=:E117:/
530 endtry
531 call assert_true(empty(&tabpanel))
532 set tabpanel&vim
533 set showtabpanel&vim
534endfunc
535
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200536" vim: shiftwidth=2 sts=2 expandtab