2024-04-20 08:44:13 -07:00
|
|
|
local n = require('test.functional.testnvim')()
|
2022-05-09 17:15:46 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-20 08:44:13 -07:00
|
|
|
|
|
|
|
local clear = n.clear
|
|
|
|
local exec = n.exec
|
|
|
|
local feed = n.feed
|
2022-05-09 17:15:46 -07:00
|
|
|
|
|
|
|
before_each(clear)
|
|
|
|
|
|
|
|
describe('statusline', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
screen = Screen.new(50, 7)
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()
|
|
|
|
exec([[
|
|
|
|
setlocal statusline=-%{mode()}-
|
|
|
|
split
|
|
|
|
setlocal statusline=+%{mode()}+
|
|
|
|
]])
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
{1:~ }|
|
2024-03-27 02:35:50 -07:00
|
|
|
{3:+n+ }|
|
2022-05-09 17:15:46 -07:00
|
|
|
|
|
|
|
|
{1:~ }|
|
2024-03-27 02:35:50 -07:00
|
|
|
{2:-n- }|
|
2022-05-09 17:15:46 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed(':')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
2024-03-27 02:35:50 -07:00
|
|
|
{3:+c+ }|
|
2022-05-09 17:15:46 -07:00
|
|
|
|
|
|
|
|
{1:~ }|
|
2024-03-27 02:35:50 -07:00
|
|
|
{2:-c- }|
|
2022-05-09 17:15:46 -07:00
|
|
|
:^ |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function()
|
|
|
|
exec([[
|
|
|
|
set laststatus=2
|
|
|
|
hi! link User1 Directory
|
|
|
|
hi! link User2 ErrorMsg
|
|
|
|
set statusline=%.5(%1*ABC%2*DEF%1*GHI%)
|
|
|
|
]])
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-03-27 02:35:50 -07:00
|
|
|
{9:<F}{18:GHI }|
|
2022-05-09 17:15:46 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-12-15 13:23:28 -07:00
|
|
|
|
|
|
|
-- oldtest: Test_statusline_showcmd()
|
|
|
|
it('showcmdloc=statusline works', function()
|
|
|
|
exec([[
|
2023-01-14 04:52:44 -07:00
|
|
|
func MyStatusLine()
|
|
|
|
return '%S'
|
|
|
|
endfunc
|
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
set showcmd
|
|
|
|
set laststatus=2
|
|
|
|
set statusline=%S
|
|
|
|
set showcmdloc=statusline
|
|
|
|
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
|
|
|
{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
|
|
|
{3:g }|
|
|
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
]])
|
2023-01-14 04:52:44 -07:00
|
|
|
|
|
|
|
-- typing "gg" should open the fold
|
|
|
|
feed('g')
|
|
|
|
screen:expect([[
|
|
|
|
^a |
|
|
|
|
b |
|
|
|
|
c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*2
|
2023-01-14 04:52:44 -07:00
|
|
|
{3: }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
feed('<C-V>Gl')
|
|
|
|
screen:expect([[
|
2024-03-27 02:35:50 -07:00
|
|
|
{17:a} |
|
|
|
|
{17:b} |
|
|
|
|
{17:c}^ |
|
|
|
|
{1:~ }|*2
|
2022-12-15 13:23:28 -07:00
|
|
|
{3:3x2 }|
|
2024-03-27 02:35:50 -07:00
|
|
|
{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([[
|
|
|
|
a |
|
|
|
|
b |
|
|
|
|
^c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*2
|
2022-12-15 13:23:28 -07:00
|
|
|
{3:1234 }|
|
|
|
|
|
|
|
|
|
]])
|
2023-01-14 04:52:44 -07:00
|
|
|
|
|
|
|
feed('<Esc>:set statusline=<CR>')
|
|
|
|
feed(':<CR>')
|
|
|
|
feed('1234')
|
2022-12-15 13:23:28 -07:00
|
|
|
screen:expect([[
|
|
|
|
a |
|
|
|
|
b |
|
|
|
|
^c |
|
2024-03-27 02:35:50 -07:00
|
|
|
{1:~ }|*2
|
2022-12-15 13:23:28 -07:00
|
|
|
{3:[No Name] [+] 1234 }|
|
|
|
|
: |
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-09 17:15:46 -07:00
|
|
|
end)
|