diff options
Diffstat (limited to 'test/functional/ui/statusline_spec.lua')
-rw-r--r-- | test/functional/ui/statusline_spec.lua | 137 |
1 files changed, 47 insertions, 90 deletions
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index 937e709d66..1d0f181244 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -24,11 +24,9 @@ for _, model in ipairs(mousemodels) do before_each(function() clear() screen = Screen.new(40, 8) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { bold = true, reverse = true }, -- StatusLine - }) - screen:attach() + screen:add_extra_attr_ids { + [100] = { bold = true, reverse = true, foreground = Screen.colors.Blue }, + } command('set laststatus=2 mousemodel=' .. model) exec([=[ function! MyClickFunc(minwid, clicks, button, mods) @@ -86,8 +84,8 @@ for _, model in ipairs(mousemodels) do screen:expect { grid = [[ ^ | - {0:~ }|*5 - {1:^I}{0:^A^I^A^I}{1:^A }| + {1:~ }|*5 + {3:^I}{100:^A^I^A^I}{3:^A }| | ]], } @@ -210,8 +208,8 @@ for _, model in ipairs(mousemodels) do screen:expect { grid = [[ ^ │ | - {0:~ }│{0:~ }|*5 - {1:Clicky stuff Clicky stuff}| + {1:~ }│{1:~ }|*5 + {3:Clicky stuff Clicky stuff}| | ]], } @@ -255,14 +253,9 @@ describe('global statusline', function() before_each(function() clear() screen = Screen.new(60, 16) - screen:attach() - screen:set_default_attr_ids({ - [1] = { bold = true, foreground = Screen.colors.Blue }, - [2] = { bold = true, reverse = true }, - [3] = { bold = true }, - [4] = { reverse = true }, - [5] = { bold = true, foreground = Screen.colors.Fuchsia }, - }) + screen:add_extra_attr_ids { + [100] = { foreground = Screen.colors.Magenta1, bold = true }, + } command('set laststatus=3') command('set ruler') end) @@ -271,7 +264,7 @@ describe('global statusline', function() screen:expect([[ ^ | {1:~ }|*13 - {2:[No Name] 0,0-1 All}| + {3:[No Name] 0,0-1 All}| | ]]) @@ -280,8 +273,8 @@ describe('global statusline', function() |*2 ^ | {1:~ }|*11 - {2:[No Name] [+] 3,1 All}| - {3:-- INSERT --} | + {3:[No Name] [+] 3,1 All}| + {5:-- INSERT --} | ]]) end) @@ -298,7 +291,7 @@ describe('global statusline', function() ────────────────────┴────────────────┴─┤{1:~ }| │{1:~ }| {1:~ }│{1:~ }|*3 - {2:[No Name] 0,0-1 All}| + {3:[No Name] 0,0-1 All}| | ]]) end) @@ -315,7 +308,7 @@ describe('global statusline', function() screen:expect([[ ^ | {1:~ }|*13 - {2:[No Name] 0,0-1 All}| + {3:[No Name] 0,0-1 All}| | ]]) @@ -324,15 +317,15 @@ describe('global statusline', function() screen:expect([[ │ │ │^ | {1:~ }│{1:~ }│{1:~}│{1:~ }|*3 - {1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }| + {1:~ }│{2:< Name] 0,0-1 }│{1:~}│{1:~ }| {1:~ }│ │{1:~}│{1:~ }| {1:~ }│{1:~ }│{1:~}│{1:~ }| - {1:~ }│{1:~ }│{1:~}│{2:<No Name] 0,0-1 All}| + {1:~ }│{1:~ }│{1:~}│{3:<No Name] 0,0-1 All}| {1:~ }│{1:~ }│{1:~}│ | - {4:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }| + {2:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }| │{1:~ }| {1:~ }│{1:~ }|*3 - {4:[No Name] 0,0-1 All <No Name] 0,0-1 All}| + {2:[No Name] 0,0-1 All <No Name] 0,0-1 All}| | ]]) @@ -348,7 +341,7 @@ describe('global statusline', function() ────────────────────┴────────────────┴─┤{1:~ }| │{1:~ }| {1:~ }│{1:~ }|*3 - {2:[No Name] 0,0-1 All}| + {3:[No Name] 0,0-1 All}| | ]]) @@ -356,12 +349,12 @@ describe('global statusline', function() screen:expect([[ │ │ │^ | {1:~ }│{1:~ }│{1:~}│{1:~ }|*3 - {1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }| + {1:~ }│{2:< Name] 0,0-1 }│{1:~}│{1:~ }| {1:~ }│ │{1:~}│{1:~ }| {1:~ }│{1:~ }│{1:~}│{1:~ }| - {1:~ }│{1:~ }│{1:~}│{2:<No Name] 0,0-1 All}| + {1:~ }│{1:~ }│{1:~}│{3:<No Name] 0,0-1 All}| {1:~ }│{1:~ }│{1:~}│ | - {4:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }| + {2:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }| │{1:~ }| {1:~ }│{1:~ }|*4 0,0-1 All | @@ -379,7 +372,7 @@ describe('global statusline', function() ────────────────────┴────────────────┴─┤{1:~ }| │{1:~ }| {1:~ }│{1:~ }|*3 - {2:[No Name] 0,0-1 All}| + {3:[No Name] 0,0-1 All}| | ]]) end) @@ -429,7 +422,7 @@ describe('global statusline', function() 0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | ^0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | - {2:test/functional/fixtures/bigfile.txt 7,1 Top}| + {3:test/functional/fixtures/bigfile.txt 7,1 Top}| | ]]) feed('j') @@ -444,12 +437,12 @@ describe('global statusline', function() 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | - {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + {3:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) api.nvim_set_option_value('showtabline', 2, {}) screen:expect([[ - {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| + {5: }{100:2}{5: t/f/f/bigfile.txt }{2: }| | {1:~ }|*5 ────────────────────────────────────────────────────────────| @@ -459,12 +452,12 @@ describe('global statusline', function() 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | - {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + {3:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) api.nvim_set_option_value('cmdheight', 0, {}) screen:expect([[ - {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| + {5: }{100:2}{5: t/f/f/bigfile.txt }{2: }| | {1:~ }|*5 ────────────────────────────────────────────────────────────| @@ -475,11 +468,11 @@ describe('global statusline', function() 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | - {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + {3:test/functional/fixtures/bigfile.txt 8,1 0%}| ]]) api.nvim_set_option_value('cmdheight', 1, {}) screen:expect([[ - {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| + {5: }{100:2}{5: t/f/f/bigfile.txt }{2: }| | {1:~ }|*5 ────────────────────────────────────────────────────────────| @@ -489,7 +482,7 @@ describe('global statusline', function() 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | - {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + {3:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) end) @@ -508,7 +501,7 @@ describe('global statusline', function() ────────────────────────────────────────────────────────────| ^ | {1:~ }|*6 - {2:[No Name] 0,0-1 All}| + {3:[No Name] 0,0-1 All}| | ]]) end) @@ -525,11 +518,6 @@ end) it('statusline is redrawn with :resize from <Cmd> mapping #19629', function() clear() local screen = Screen.new(40, 8) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { bold = true, reverse = true }, -- StatusLine - }) - screen:attach() exec([[ set laststatus=2 nnoremap <Up> <cmd>resize -1<CR> @@ -538,15 +526,15 @@ it('statusline is redrawn with :resize from <Cmd> mapping #19629', function() feed('<Up>') screen:expect([[ ^ | - {0:~ }|*4 - {1:[No Name] }| + {1:~ }|*4 + {3:[No Name] }| |*2 ]]) feed('<Down>') screen:expect([[ ^ | - {0:~ }|*5 - {1:[No Name] }| + {1:~ }|*5 + {3:[No Name] }| | ]]) end) @@ -554,19 +542,13 @@ end) it('showcmdloc=statusline does not show if statusline is too narrow', function() clear() local screen = Screen.new(40, 8) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { bold = true, reverse = true }, -- StatusLine - [2] = { reverse = true }, -- StatusLineNC - }) - screen:attach() command('set showcmd') command('set showcmdloc=statusline') command('1vsplit') screen:expect([[ ^ │ | - {0:~}│{0:~ }|*5 - {1:< }{2:[No Name] }| + {1:~}│{1:~ }|*5 + {3:< }{2:[No Name] }| | ]]) feed('1234') @@ -575,8 +557,7 @@ end) it('K_EVENT does not trigger a statusline redraw unnecessarily', function() clear() - local screen = Screen.new(40, 8) - screen:attach() + local _ = Screen.new(40, 8) -- does not redraw on vim.schedule (#17937) command([[ set laststatus=2 @@ -608,7 +589,6 @@ end) it('statusline is redrawn on various state changes', function() clear() local screen = Screen.new(40, 4) - screen:attach() -- recording state change #22683 command('set ls=2 stl=%{repeat(reg_recording(),5)}') @@ -674,7 +654,6 @@ end) it('ruler is redrawn in cmdline with redrawstatus #22804', function() clear() local screen = Screen.new(40, 2) - screen:attach() command([[ let g:n = 'initial value' set ls=1 ru ruf=%{g:n} @@ -691,12 +670,6 @@ end) it('shows correct ruler in cmdline with no statusline', function() clear() local screen = Screen.new(30, 8) - screen:set_default_attr_ids { - [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [2] = { bold = true, reverse = true }, -- StatusLine - [3] = { reverse = true }, -- StatusLineNC - } - screen:attach() -- Use long ruler to check 'ruler' with 'rulerformat' set has correct width. command [[ set ruler rulerformat=%{winnr()}longlonglong ls=0 winwidth=10 @@ -713,7 +686,7 @@ it('shows correct ruler in cmdline with no statusline', function() screen:expect [[ ^ | {1:~ }|*2 - {2:[No Name] 1longlonglong }| + {3:[No Name] 1longlonglong }| │ | {1:~ }│{1:~ }|*2 3longlonglong | @@ -724,7 +697,7 @@ it('shows correct ruler in cmdline with no statusline', function() screen:expect [[ | {1:~ }|*2 - {3:[No Name] 1longlonglong }| + {2:[No Name] 1longlonglong }| ^ │ | {1:~ }│{1:~ }|*2 2longlonglong | @@ -734,7 +707,7 @@ it('shows correct ruler in cmdline with no statusline', function() screen:expect [[ | {1:~ }|*2 - {3:[No Name] 1longlonglong }| + {2:[No Name] 1longlonglong }| │^ | {1:~ }│{1:~ }|*2 3longlonglong | @@ -744,10 +717,6 @@ end) it('uses "stl" and "stlnc" fillchars even if they are the same #19803', function() clear() local screen = Screen.new(53, 4) - screen:attach() - screen:set_default_attr_ids({ - [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - }) command('hi clear StatusLine') command('hi clear StatusLineNC') command('vsplit') @@ -764,19 +733,13 @@ end) it('showcmdloc=statusline works with vertical splits', function() clear() local screen = Screen.new(53, 4) - screen:set_default_attr_ids { - [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [2] = { bold = true, reverse = true }, -- StatusLine - [3] = { reverse = true }, -- StatusLineNC - } - screen:attach() command('rightbelow vsplit') command('set showcmd showcmdloc=statusline') feed('1234') screen:expect([[ │^ | {1:~ }│{1:~ }| - {3:[No Name] }{2:[No Name] 1234 }| + {2:[No Name] }{3:[No Name] 1234 }| | ]]) feed('<Esc>') @@ -785,7 +748,7 @@ it('showcmdloc=statusline works with vertical splits', function() screen:expect([[ │^ | {1:~ }│{1:~ }| - {2:[No Name] 1234 }| + {3:[No Name] 1234 }| | ]]) end) @@ -793,25 +756,19 @@ end) it('keymap is shown with vertical splits #27269', function() clear() local screen = Screen.new(53, 4) - screen:set_default_attr_ids { - [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [2] = { bold = true, reverse = true }, -- StatusLine - [3] = { reverse = true }, -- StatusLineNC - } - screen:attach() command('setlocal keymap=dvorak') command('rightbelow vsplit') screen:expect([[ │^ | {1:~ }│{1:~ }| - {3:[No Name] <en-dv> }{2:[No Name] <en-dv> }| + {2:[No Name] <en-dv> }{3:[No Name] <en-dv> }| | ]]) command('set laststatus=3') screen:expect([[ │^ | {1:~ }│{1:~ }| - {2:[No Name] <en-dv> }| + {3:[No Name] <en-dv> }| | ]]) end) |