blob: 0d79650834cfb8c3550fdd8d14109c64357aa075 [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 Higashif5aa2692025-06-15 16:09:22 +020013function Test_tabpanel_showtabpanel_eq_0()
14 CheckScreendump
15
16 let lines =<< trim END
17 set showtabpanel=2
18 set noruler
19 call setbufline(bufnr(), 1, ['aaa','bbb','ccc','ddd'])
20 tabnew 0000
21 END
22 call writefile(lines, 'XTest_tabpanel_stpl_eq_0', 'D')
23
24 let buf = RunVimInTerminal('-S XTest_tabpanel_stpl_eq_0', {'rows': 10, 'cols': 78})
25 call term_sendkeys(buf, ":set showtabpanel=0\<CR>\<C-L>")
26 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_0_0', {})
27 call term_sendkeys(buf, ":tabnext\<CR>\<C-L>")
28 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_0_1', {})
29 call StopVimInTerminal(buf)
30endfunc
31
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +020032function Test_tabpanel_showtabpanel_eq_1()
33 CheckScreendump
34
35 let lines =<< trim END
36 set showtabpanel=1
37 set noruler
38 END
39 call writefile(lines, 'XTest_tabpanel_stpl_eq_1', 'D')
40
41 let buf = RunVimInTerminal('-S XTest_tabpanel_stpl_eq_1', {'rows': 10, 'cols': 78})
42 call term_sendkeys(buf, "\<C-L>")
43 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_0', {})
44 call term_sendkeys(buf, ":tabnew\<CR>\<C-L>")
45 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_1', {})
46 call term_sendkeys(buf, ":tabfirst\<CR>:vsplit\<CR>\<C-L>")
47 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_2', {})
48 call term_sendkeys(buf, ":tabclose\<CR>\<C-L>")
49 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_0', {})
50
51 call term_sendkeys(buf, ":set tabpanelopt=align:right\<CR>\<C-L>")
52 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_0', {})
53 call term_sendkeys(buf, ":tabnew\<CR>\<C-L>")
54 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_3', {})
55 call term_sendkeys(buf, ":tabfirst\<CR>:vsplit\<CR>\<C-L>")
56 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_4', {})
57 call term_sendkeys(buf, ":tabclose\<CR>\<C-L>")
58 call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_1_0', {})
59 call StopVimInTerminal(buf)
60endfunc
61
62function Test_tabpanel_with_vsplit()
63 CheckScreendump
64
65 let lines =<< trim END
66 set showtabpanel=2
67 set tabpanelopt=columns:20
68 set showtabline=0
69 tabnew
70 END
71 call writefile(lines, 'XTest_tabpanel_with_vsplit', 'D')
72
73 let buf = RunVimInTerminal('-S XTest_tabpanel_with_vsplit', {'rows': 10, 'cols': 78})
74 call VerifyScreenDump(buf, 'Test_tabpanel_with_vsplit_0', {})
75 call term_sendkeys(buf, ":vsplit\<CR>")
76 call VerifyScreenDump(buf, 'Test_tabpanel_with_vsplit_1', {})
77 call term_sendkeys(buf, ":vsplit\<CR>")
78 call VerifyScreenDump(buf, 'Test_tabpanel_with_vsplit_2', {})
79
80 call term_sendkeys(buf, ":only\<CR>")
81 call term_sendkeys(buf, ":set tabpanelopt=align:right,vert\<CR>")
82 call VerifyScreenDump(buf, 'Test_tabpanel_with_vsplit_3', {})
83 call term_sendkeys(buf, ":vsplit\<CR>")
84 call VerifyScreenDump(buf, 'Test_tabpanel_with_vsplit_4', {})
85 call term_sendkeys(buf, ":vsplit\<CR>")
86 call VerifyScreenDump(buf, 'Test_tabpanel_with_vsplit_5', {})
87 call StopVimInTerminal(buf)
88endfunc
89
Hirohito Higashic659e4a2025-05-16 19:34:34 +020090function Test_tabpanel_mouse()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +020091 let save_showtabline = &showtabline
92 let save_mouse = &mouse
93 set showtabline=0 mouse=a
94
95 tabnew
96 tabnew
97
98 call test_setmouse(1, 1)
99 call feedkeys("\<LeftMouse>", 'xt')
100 call assert_equal(3, tabpagenr())
101
102 set showtabpanel=2 tabpanelopt=columns:10
103
104 call test_setmouse(1, 1)
105 call feedkeys("\<LeftMouse>", 'xt')
106 call assert_equal(1, tabpagenr())
107 call test_setmouse(2, 1)
108 call feedkeys("\<LeftMouse>", 'xt')
109 call assert_equal(2, tabpagenr())
110 call test_setmouse(3, 1)
111 call feedkeys("\<LeftMouse>", 'xt')
112 call assert_equal(3, tabpagenr())
113
Hirohito Higashia1522f72025-06-03 21:07:25 +0200114 " Confirm that tabpagenr() does not change when dragging outside the tabpanel
115 call test_setmouse(3, 30)
116 call feedkeys("\<LeftMouse>", 'xt')
117 call test_setmouse(1, 30)
118 call feedkeys("\<LeftDrag>", 'xt')
119 call assert_equal(3, tabpagenr())
120
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200121 call feedkeys("\<LeftMouse>", 'xt')
122 call test_setmouse(2, 3)
123 let pos = getmousepos()
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200124 call assert_equal(0, pos['winid'])
125 call assert_equal(0, pos['winrow'])
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200126 call assert_equal(0, pos['wincol'])
127 call assert_equal(2, pos['screenrow'])
128 call assert_equal(3, pos['screencol'])
129
130 call test_setmouse(1, 11)
131 call feedkeys("\<LeftMouse>", 'xt')
132 let pos = getmousepos()
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200133 call assert_notequal(0, pos['winid'])
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200134 call assert_equal(1, pos['winrow'])
135 call assert_equal(1, pos['wincol'])
136 call assert_equal(1, pos['screenrow'])
137 call assert_equal(11, pos['screencol'])
138
139 new
140 wincmd x
141
142 call test_setmouse(10, 11)
143 call feedkeys("\<LeftMouse>", 'xt')
144 let pos = getmousepos()
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200145 call assert_notequal(0, pos['winid'])
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200146 call assert_equal(10, pos['winrow'])
147 call assert_equal(1, pos['wincol'])
148 call assert_equal(10, pos['screenrow'])
149 call assert_equal(11, pos['screencol'])
150
151 tabonly!
152 call s:reset()
153 let &mouse = save_mouse
154 let &showtabline = save_showtabline
155endfunc
156
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200157function Test_tabpanel_drawing()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200158 CheckScreendump
159
160 let lines =<< trim END
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200161 function MyTabPanel()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200162 let n = g:actual_curtabpage
163 let hi = n == tabpagenr() ? 'TabLineSel' : 'TabLine'
164 let label = printf("\n%%#%sTabNumber#%d:%%#%s#", hi, n, hi)
165 let label ..= '%1*%f%*'
166 return label
167 endfunction
168 hi User1 ctermfg=12
169
170 set showtabline=0
171 set showtabpanel=0
172 set tabpanelopt=columns:16
173 set tabpanel=
174 silent edit Xtabpanel1
175
176 nnoremap \01 <Cmd>set showtabpanel=2<CR>
177 nnoremap \02 <C-w>v
178 nnoremap \03 <Cmd>call setline(1, ['a', 'b', 'c'])<CR>
179 nnoremap \04 <Cmd>silent tabnew Xtabpanel2<CR><Cmd>call setline(1, ['d', 'e', 'f'])<CR>
180 nnoremap \05 <Cmd>set tabpanel=%!MyTabPanel()<CR>
181 nnoremap \06 <Cmd>set tabpanelopt+=align:right<CR>
182 nnoremap \07 <Cmd>tab terminal NONE<CR><C-w>N
183 nnoremap \08 <Cmd>tabclose!<CR><Cmd>tabclose!<CR>
184 END
185 call writefile(lines, 'XTest_tabpanel', 'D')
186
187 let buf = RunVimInTerminal('-S XTest_tabpanel', {'rows': 6, 'cols': 45})
188
189 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_00', {})
190
191 for i in range(1, 8)
192 let n = printf('%02d', i)
193 call term_sendkeys(buf, '\' .. n)
194 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_' .. n, {})
195 endfor
196
197 call StopVimInTerminal(buf)
198endfunc
199
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200200function Test_tabpanel_drawing_with_popupwin()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200201 CheckScreendump
202
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200203 let tcols = 45
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200204 let lines =<< trim END
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200205 set showtabpanel=0
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200206 set tabpanelopt=columns:20
207 set showtabline=0
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200208 set nowrap
209 set noruler
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200210 tabnew
211 setlocal buftype=nofile
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200212 call setbufline(bufnr(), 1, repeat([repeat('.', &columns)], &lines - &ch))
213 for col in [1, &columns - 2]
214 call popup_create(['@'],
215 \ {
216 \ 'line': 1,
217 \ 'col': col,
218 \ 'border': [],
219 \ 'highlight': 'ErrorMsg',
220 \ })
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200221 endfor
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200222 call cursor(5, 10)
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200223 call popup_atcursor('atcursor', {
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200224 \ 'highlight': 'Question',
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200225 \ })
226 END
227 call writefile(lines, 'XTest_tabpanel_with_popupwin', 'D')
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200228 let buf = RunVimInTerminal('-S XTest_tabpanel_with_popupwin', {'rows': 10, 'cols': tcols})
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200229 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_with_popupwin_0', {})
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200230 call term_sendkeys(buf, ":set showtabpanel=2\<CR>\<C-L>")
231 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_with_popupwin_1', {})
232 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>\<C-L>")
233 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_with_popupwin_2', {})
234 call term_sendkeys(buf, ":set showtabpanel=0\<CR>\<C-L>")
235 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_with_popupwin_0', {})
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200236 call StopVimInTerminal(buf)
237endfunc
238
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200239function Test_tabpanel_drawing_fill_tailing()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200240 CheckScreendump
241
242 let lines =<< trim END
243 set showtabpanel=2
244 set tabpanelopt=columns:20
245 set showtabline=0
246 e aaa.txt
247 tabnew
248 e bbb.txt
249 let &tabpanel = "abc"
250 redraw!
251 " Check whether "abc" is cleared
252 let &tabpanel = "\nTOP\n%f\nBOTTOM"
253 END
254 call writefile(lines, 'XTest_tabpanel_fill_tailing', 'D')
255
256 let buf = RunVimInTerminal('-S XTest_tabpanel_fill_tailing', {'rows': 10, 'cols': 45})
257
258 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_fill_tailing_0', {})
259
260 call StopVimInTerminal(buf)
261endfunc
262
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200263function Test_tabpanel_drawing_pum()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200264 CheckScreendump
265
266 let lines =<< trim END
267 set showtabpanel=2
268 set tabpanelopt=columns:20
269 set showtabline=0
270 e aaa.txt
271 tabnew
272 e bbb.txt
273 END
274 call writefile(lines, 'XTest_tabpanel_pum', 'D')
275
276 let buf = RunVimInTerminal('-S XTest_tabpanel_pum', {'rows': 10, 'cols': 45})
277
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200278 call term_sendkeys(buf, "i\<CR>aa\<CR>aaaa\<CR>aaac\<CR>aaab\<CR>\<Esc>")
279 call term_sendkeys(buf, "ggi\<C-X>\<C-N>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200280 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_pum_0', {})
281
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200282 call term_sendkeys(buf, "\<Esc>Go a\<C-X>\<C-P>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200283 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_pum_1', {})
284
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200285 call term_sendkeys(buf, "\<C-U>\<CR>\<Esc>")
286 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
287 let num = 45 - 20 - 2 " term-win-width - tabpanel-columns - 2
288 call term_sendkeys(buf, num .. "a \<Esc>")
289 call term_sendkeys(buf, "a\<C-X>\<C-N>")
290 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_pum_2', {})
291
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200292 call StopVimInTerminal(buf)
293endfunc
294
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200295function Test_tabpanel_scrolling()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200296 CheckScreendump
297
298 let lines =<< trim END
299 set showtabpanel=2
300 set tabpanelopt=columns:20
301 set showtabline=0
302 set nowrap
303 set number
304 e aaa.txt
305 tabnew
306 e bbb.txt
307 vsplit
308 call setbufline(bufnr(), 1, repeat(['text text text text'], 100))
309 wincmd =
310 END
311 call writefile(lines, 'XTest_tabpanel_scrolling', 'D')
312
313 let buf = RunVimInTerminal('-S XTest_tabpanel_scrolling', {'rows': 10, 'cols': 45})
314 let n = 0
315 for c in ['H', 'J', 'K', 'L']
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200316 call term_sendkeys(buf, ":wincmd " .. c .. "\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200317 call term_sendkeys(buf, "\<C-d>\<C-d>")
318 call term_sendkeys(buf, "r@")
319 call VerifyScreenDump(buf, 'Test_tabpanel_drawing_scrolling_' .. n, {})
320 let n += 1
321 endfor
322
323 call StopVimInTerminal(buf)
324endfunc
325
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200326function Test_tabpanel_many_tabpages()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200327 CheckScreendump
328
329 let lines =<< trim END
330 set showtabpanel=2
331 set tabpanelopt=columns:10
332 set showtabline=0
333 set tabpanel=%{g:actual_curtabpage}:tab
334 execute join(repeat(['tabnew'], 20), ' | ')
335 END
336 call writefile(lines, 'XTest_tabpanel_many_tabpages', 'D')
337
338 let buf = RunVimInTerminal('-S XTest_tabpanel_many_tabpages', {'rows': 10, 'cols': 45})
339 for n in range(0, 3)
340 call term_sendkeys(buf, "gt")
341 call VerifyScreenDump(buf, 'Test_tabpanel_many_tabpages_' .. n, {})
342 endfor
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200343 call term_sendkeys(buf, ":tabnext +10\<CR>")
344 call term_sendkeys(buf, ":tabnext -3\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200345 call VerifyScreenDump(buf, 'Test_tabpanel_many_tabpages_4', {})
346
347 call StopVimInTerminal(buf)
348endfunc
349
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200350function Test_tabpanel_visual()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200351 CheckScreendump
352
353 let lines =<< trim END
354 set showtabpanel=2
355 set tabpanelopt=columns:10
356 set showtabline=0
357 tabnew
358 call setbufline(bufnr(), 1, ['aaa1 bbb1 ccc1 ddd1', 'aaa2 bbb2 ccc2 ddd2', 'aaa3 bbb3 ccc3 ddd3', 'aaa4 bbb4 ccc4 ddd4'])
359 END
360 call writefile(lines, 'XTest_tabpanel_visual', 'D')
361
362 let buf = RunVimInTerminal('-S XTest_tabpanel_visual', {'rows': 10, 'cols': 45})
363 call term_sendkeys(buf, "v2w")
364 call VerifyScreenDump(buf, 'Test_tabpanel_visual_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200365 call term_sendkeys(buf, "\<Esc>0jw")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200366 call term_sendkeys(buf, "v2wge")
367 call VerifyScreenDump(buf, 'Test_tabpanel_visual_1', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200368 call term_sendkeys(buf, "y:echo @\"\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200369 call VerifyScreenDump(buf, 'Test_tabpanel_visual_2', {})
370
371 call StopVimInTerminal(buf)
372endfunc
373
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200374function Test_tabpanel_commandline()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200375 CheckScreendump
376
377 let lines =<< trim END
378 set showtabpanel=2
379 set tabpanelopt=columns:10
380 set showtabline=0
381 tabnew
382 END
383 call writefile(lines, 'XTest_tabpanel_commandline', 'D')
384
385 let buf = RunVimInTerminal('-S XTest_tabpanel_commandline', {'rows': 10, 'cols': 45})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200386 call term_sendkeys(buf, ":ab\<Tab>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200387 call VerifyScreenDump(buf, 'Test_tabpanel_commandline_0', {})
388
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200389 call term_sendkeys(buf, "\<Esc>")
390 call term_sendkeys(buf, ":set wildoptions=pum\<CR>")
391 call term_sendkeys(buf, ":ab\<Tab>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200392 call VerifyScreenDump(buf, 'Test_tabpanel_commandline_1', {})
393
394 call StopVimInTerminal(buf)
395endfunc
396
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200397function Test_tabpanel_tabline_and_tabpanel()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200398 CheckScreendump
399
400 let lines =<< trim END
401 set showtabpanel=2
402 set tabpanelopt=columns:10,vert
403 set fillchars=tpl_vert:│
404 set showtabline=2
405 e aaa.txt
406 tabnew
407 e bbb.txt
408 tabnew
409 e ccc.txt
410 END
411 call writefile(lines, 'XTest_tabpanel_tabline_and_tabpanel', 'D')
412
413 let buf = RunVimInTerminal('-S XTest_tabpanel_tabline_and_tabpanel', {'rows': 10, 'cols': 45})
414 call VerifyScreenDump(buf, 'Test_tabpanel_tabline_and_tabpanel_0', {})
415
416 call StopVimInTerminal(buf)
417endfunc
418
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200419function Test_tabpanel_dont_overflow_into_tabpanel()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200420 CheckScreendump
421
422 let lines =<< trim END
423 set showtabpanel=2
424 set tabpanelopt=columns:10
425 set showtabline=2
426 tabnew
427 call setline(1, repeat('x', 100))
428 set wrap
429 END
430 call writefile(lines, 'XTest_tabpanel_dont_overflow_into_tabpanel', 'D')
431
432 let buf = RunVimInTerminal('-S XTest_tabpanel_dont_overflow_into_tabpanel', {'rows': 10, 'cols': 45})
433 call VerifyScreenDump(buf, 'Test_tabpanel_dont_overflow_into_tabpanel_0', {})
434
435 call StopVimInTerminal(buf)
436endfunc
437
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200438"""function Test_tabpanel_dont_vert_is_multibytes_left()
439""" CheckScreendump
440"""
441""" let lines =<< trim END
442""" set showtabpanel=2
443""" set tabpanelopt=columns:10,vert
444""" set fillchars=tpl_vert:│
445""" set showtabline=2
446""" tabnew
447""" END
448""" call writefile(lines, 'XTest_tabpanel_vert_is_multibyte_lefts', 'D')
449"""
450""" let buf = RunVimInTerminal('-S XTest_tabpanel_vert_is_multibyte_lefts', {'rows': 10, 'cols': 45})
451""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_0', {})
452"""
453""" call term_sendkeys(buf, ":set tabpanelopt=columns:1,vert\<CR>")
454""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_1', {})
455"""
456""" call term_sendkeys(buf, ":set tabpanelopt=columns:10,vert\<CR>")
457""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_2', {})
458"""
459""" call term_sendkeys(buf, ":set tabpanelopt=columns:2,vert\<CR>")
460""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_left_3', {})
461"""
462""" call StopVimInTerminal(buf)
463"""endfunc
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200464
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200465"""function Test_tabpanel_dont_vert_is_multibytes_right()
466""" CheckScreendump
467"""
468""" let lines =<< trim END
469""" set showtabpanel=2
470""" set tabpanelopt=align:right,columns:10,vert
471""" set fillchars=tpl_vert:│
472""" set showtabline=2
473""" tabnew
474""" END
475""" call writefile(lines, 'XTest_tabpanel_vert_is_multibytes_right', 'D')
476"""
477""" let buf = RunVimInTerminal('-S XTest_tabpanel_vert_is_multibytes_right', {'rows': 10, 'cols': 45})
478""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_0', {})
479"""
480""" call term_sendkeys(buf, ":set tabpanelopt=align:right,columns:1,vert\<CR>")
481""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_1', {})
482"""
483""" call term_sendkeys(buf, ":set tabpanelopt=align:right,columns:10,vert\<CR>")
484""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_2', {})
485"""
486""" call term_sendkeys(buf, ":set tabpanelopt=align:right,columns:2,vert\<CR>")
487""" call VerifyScreenDump(buf, 'Test_tabpanel_vert_is_multibytes_right_3', {})
488"""
489""" call StopVimInTerminal(buf)
490"""endfunc
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200491
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200492function Test_tabpanel_eval_tabpanel_statusline_tabline()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200493 CheckScreendump
494
495 let lines =<< trim END
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200496 function Expr()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200497 return "$%=[%f]%=$"
498 endfunction
499 set laststatus=2
500 set showtabline=2
501 set showtabpanel=2
502 set statusline=%!Expr()
503 set tabline=%!Expr()
504 set tabpanel=%!Expr()
505 set tabpanelopt=columns:10,vert
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200506 e aaa
507 tabnew
508 e bbb
509 tabnew
510 e ccc
511 END
512 call writefile(lines, 'XTest_tabpanel_eval_tabpanel_statusline_tabline', 'D')
513
514 let buf = RunVimInTerminal('-S XTest_tabpanel_eval_tabpanel_statusline_tabline', {'rows': 10, 'cols': 45})
515 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_statusline_tabline_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200516 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200517 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_statusline_tabline_1', {})
518
519 call StopVimInTerminal(buf)
520endfunc
521
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200522function Test_tabpanel_noeval_tabpanel_statusline_tabline()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200523 CheckScreendump
524
525 let lines =<< trim END
526 set laststatus=2
527 set showtabline=2
528 set showtabpanel=2
529 set statusline=$%=[%f]%=$
530 set tabline=$%=[%f]%=$
531 set tabpanel=$%=[%f]%=$
532 set tabpanelopt=columns:10,vert
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200533 e aaa
534 tabnew
535 e bbb
536 tabnew
537 e ccc
538 END
539 call writefile(lines, 'XTest_tabpanel_noeval_tabpanel_statusline_tabline', 'D')
540
541 let buf = RunVimInTerminal('-S XTest_tabpanel_noeval_tabpanel_statusline_tabline', {'rows': 10, 'cols': 45})
542 call VerifyScreenDump(buf, 'Test_tabpanel_noeval_tabpanel_statusline_tabline_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200543 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200544 call VerifyScreenDump(buf, 'Test_tabpanel_noeval_tabpanel_statusline_tabline_1', {})
545
546 call StopVimInTerminal(buf)
547endfunc
548
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200549function Test_tabpanel_eval_tabpanel_with_linebreaks()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200550 CheckScreendump
551
552 let lines =<< trim END
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200553 function Expr()
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200554 return "top\n$%=[%f]%=$\nbottom"
555 endfunction
556 set showtabpanel=2
557 set tabpanel=%!Expr()
558 set tabpanelopt=columns:10
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200559 set noruler
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200560 e aaa
561 tabnew
562 e bbb
563 tabnew
564 e ccc
565 END
566 call writefile(lines, 'XTest_tabpanel_eval_tabpanel_with_linebreaks', 'D')
567
568 let buf = RunVimInTerminal('-S XTest_tabpanel_eval_tabpanel_with_linebreaks', {'rows': 10, 'cols': 45})
569 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_with_linebreaks_0', {})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200570 call term_sendkeys(buf, ":set tabpanelopt+=align:right\<CR>")
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200571 call VerifyScreenDump(buf, 'Test_tabpanel_eval_tabpanel_with_linebreaks_1', {})
572
573 call StopVimInTerminal(buf)
574endfunc
575
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200576function Test_tabpanel_tabonly()
577 CheckScreendump
578
579 let lines =<< trim END
580 tabnew
581 set showtabpanel=1
582 norm 100oasdf
583 vsplit
584 END
585 call writefile(lines, 'XTest_tabpanel_tabonly', 'D')
586
Christian Brabandta004e512025-05-26 19:54:07 +0200587 let buf = RunVimInTerminal('-S XTest_tabpanel_tabonly', {'rows': 10, 'cols': 78})
Hirohito Higashic659e4a2025-05-16 19:34:34 +0200588 call VerifyScreenDump(buf, 'Test_tabpanel_only_0', {})
589 call term_sendkeys(buf, ":tabonly\<CR>")
590 call VerifyScreenDump(buf, 'Test_tabpanel_only_1', {})
591
592 call StopVimInTerminal(buf)
593endfunc
594
Naruhiko Nishino2a1e2532025-05-17 16:19:24 +0200595function Test_tabpanel_equalalways()
596 CheckScreendump
597
598 let lines =<< trim END
599 tabnew
600 set showtabpanel=1
601 set tabpanelopt=columns:20
602 set equalalways
603 split
604 vsplit
605 END
606 call writefile(lines, 'XTest_tabpanel_equalalways', 'D')
607
608 let buf = RunVimInTerminal('-S XTest_tabpanel_equalalways', {'rows': 10, 'cols': 78})
609 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_0', {})
610 call term_sendkeys(buf, ":set tabpanelopt=columns:10\<CR>")
611 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_1', {})
612 call term_sendkeys(buf, ":set tabpanelopt=columns:30\<CR>")
613 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_2', {})
614 call term_sendkeys(buf, ":set tabpanelopt=columns:5\<CR>")
615 call VerifyScreenDump(buf, 'Test_tabpanel_equalalways_3', {})
616
617 call StopVimInTerminal(buf)
618endfunc
619
Hirohito Higashi3b9b95d2025-06-01 20:22:55 +0200620function Test_tabpanel_quitall()
621 CheckScreendump
622
623 let lines =<< trim END
624 tabnew
625 set showtabpanel=1
626 set laststatus=2
627 call setline(1, 'aaa')
628 normal gt
629 silent! quitall
630 END
631 call writefile(lines, 'XTest_tabpanel_quitall', 'D')
632
633 let buf = RunVimInTerminal('-S XTest_tabpanel_quitall', {'rows': 10, 'cols': 45})
634 call VerifyScreenDump(buf, 'Test_tabpanel_quitall_0', {})
635
636 call StopVimInTerminal(buf)
637endfunc
638
639function Test_tabpanel_ruler()
640 CheckScreendump
641
642 let lines =<< trim END
643 tabnew
644 set statusline& laststatus=0
645 set rulerformat& ruler
646 set showtabpanel=1
647 END
648 call writefile(lines, 'XTest_tabpanel_ruler', 'D')
649
650 let buf = RunVimInTerminal('-S XTest_tabpanel_ruler', {'rows': 10, 'cols': 45})
651 call VerifyScreenDump(buf, 'Test_tabpanel_ruler_0', {})
652
653 call StopVimInTerminal(buf)
654endfunc
655
Christian Brabandta88c5bd2025-05-26 19:51:03 +0200656function Test_tabpanel_error()
657 set tabpanel=%!NonExistingFunc()
658 try
659 set showtabpanel=2
660 redraw!
661 catch /^Vim\%((\a\+)\)\=:E117:/
662 endtry
663 call assert_true(empty(&tabpanel))
Christian Brabandtac83b3c2025-05-27 20:49:34 +0200664
665 try
666 set tabpanel=%{my#util#TabPanelHighlight}%t
667 redraw!
668 catch /^Vim\%((\a\+)\)\=:E121:/
669 endtry
670 call assert_true(empty(&tabpanel))
671
Christian Brabandta88c5bd2025-05-26 19:51:03 +0200672 set tabpanel&vim
673 set showtabpanel&vim
674endfunc
Hirohito Higashi3ca67762025-06-10 20:19:04 +0200675
676function Test_tabpanel_with_msg_scrolled()
677 CheckScreendump
678
679 let lines =<< trim END
680 set showtabpanel=2
681 set noruler
682 tabnew
683 set modified
684 tabfirst
685 END
686 call writefile(lines, 'XTest_tabpanel_with_msg_scrolled', 'D')
687
688 let buf = RunVimInTerminal('-S XTest_tabpanel_with_msg_scrolled', {'rows': 10, 'cols': 45})
689 call VerifyScreenDump(buf, 'Test_tabpanel_with_msg_scrolled_0', {})
690 call term_sendkeys(buf, ":qa\<CR>")
691 call term_sendkeys(buf, "\<CR>")
692 call VerifyScreenDump(buf, 'Test_tabpanel_with_msg_scrolled_1', {})
693
694 call StopVimInTerminal(buf)
695endfunc
Naruhiko Nishinobe5bd4d2025-05-14 21:20:28 +0200696" vim: shiftwidth=2 sts=2 expandtab