2024-04-09 04:26:16 -07:00
|
|
|
local t = require('test.functional.testutil')()
|
2022-12-15 13:23:28 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-08 02:03:20 -07:00
|
|
|
local clear = t.clear
|
|
|
|
local exec = t.exec
|
|
|
|
local feed = t.feed
|
2022-12-15 13:23:28 -07:00
|
|
|
|
|
|
|
before_each(clear)
|
|
|
|
|
|
|
|
describe('tabline', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
screen = Screen.new(50, 7)
|
|
|
|
screen:attach()
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- oldtest: Test_tabline_showcmd()
|
|
|
|
it('showcmdloc=tabline works', function()
|
|
|
|
exec([[
|
2023-01-14 04:52:44 -07:00
|
|
|
func MyTabLine()
|
|
|
|
return '%S'
|
|
|
|
endfunc
|
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
set showcmd
|
|
|
|
set showtabline=2
|
2023-01-14 04:52:44 -07:00
|
|
|
set tabline=%!MyTabLine()
|
2022-12-15 13:23:28 -07:00
|
|
|
set showcmdloc=tabline
|
|
|
|
call setline(1, ['a', 'b', 'c'])
|
2023-01-14 04:52:44 -07:00
|
|
|
set foldopen+=jump
|
|
|
|
1,2fold
|
|
|
|
3
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('g')
|
|
|
|
screen:expect([[
|
2024-03-27 02:35:50 -07:00
|
|
|
{2:g }|
|
|
|
|
{13:+-- 2 lines: a···································}|
|
2023-01-14 04:52:44 -07:00
|
|
|
^c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*3
|
2023-01-14 04:52:44 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
-- typing "gg" should open the fold
|
|
|
|
feed('g')
|
|
|
|
screen:expect([[
|
2024-03-27 02:35:50 -07:00
|
|
|
{2: }|
|
2023-01-14 04:52:44 -07:00
|
|
|
^a |
|
|
|
|
b |
|
|
|
|
c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*2
|
2023-01-14 04:52:44 -07:00
|
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
]])
|
2023-01-14 04:52:44 -07:00
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
feed('<C-V>Gl')
|
|
|
|
screen:expect([[
|
2024-03-27 02:35:50 -07:00
|
|
|
{2:3x2 }|
|
|
|
|
{17:a} |
|
|
|
|
{17:b} |
|
|
|
|
{17:c}^ |
|
|
|
|
{1:~ }|*2
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2022-12-15 13:23:28 -07:00
|
|
|
]])
|
2023-01-14 04:52:44 -07:00
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
feed('<Esc>1234')
|
|
|
|
screen:expect([[
|
2024-03-27 02:35:50 -07:00
|
|
|
{2:1234 }|
|
2022-12-15 13:23:28 -07:00
|
|
|
a |
|
|
|
|
b |
|
|
|
|
^c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*2
|
2022-12-15 13:23:28 -07:00
|
|
|
|
|
|
|
|
]])
|
2023-01-14 04:52:44 -07:00
|
|
|
|
|
|
|
feed('<Esc>:set tabline=<CR>')
|
|
|
|
feed(':<CR>')
|
|
|
|
feed('1234')
|
|
|
|
screen:expect([[
|
2024-03-27 02:35:50 -07:00
|
|
|
{5: + [No Name] }{2: }{24:1234}{2: }|
|
2023-01-14 04:52:44 -07:00
|
|
|
a |
|
|
|
|
b |
|
|
|
|
^c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*2
|
2023-01-14 04:52:44 -07:00
|
|
|
: |
|
|
|
|
]])
|
2022-12-15 13:23:28 -07:00
|
|
|
end)
|
|
|
|
end)
|