aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/winbar_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/winbar_spec.lua')
-rw-r--r--test/functional/ui/winbar_spec.lua130
1 files changed, 81 insertions, 49 deletions
diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua
index 65fd5d31f5..502c61a31b 100644
--- a/test/functional/ui/winbar_spec.lua
+++ b/test/functional/ui/winbar_spec.lua
@@ -19,17 +19,26 @@ describe('winbar', function()
screen = Screen.new(60, 13)
screen:attach()
screen:set_default_attr_ids({
- [1] = {bold = true},
- [2] = {reverse = true},
- [3] = {bold = true, foreground = Screen.colors.Blue},
- [4] = {bold = true, reverse = true},
- [5] = {bold = true, foreground = Screen.colors.Red},
- [6] = {foreground = Screen.colors.Blue},
- [7] = {background = Screen.colors.LightGrey},
- [8] = {background = Screen.colors.LightMagenta},
- [9] = {bold = true, foreground = Screen.colors.Blue, background = Screen.colors.LightMagenta},
- [10] = {background = Screen.colors.LightGrey, underline = true},
- [11] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
+ [1] = { bold = true },
+ [2] = { reverse = true },
+ [3] = { bold = true, foreground = Screen.colors.Blue },
+ [4] = { bold = true, reverse = true },
+ [5] = { bold = true, foreground = Screen.colors.Red },
+ [6] = { foreground = Screen.colors.Blue },
+ [7] = { background = Screen.colors.LightGrey },
+ [8] = { background = Screen.colors.LightMagenta },
+ [9] = {
+ bold = true,
+ foreground = Screen.colors.Blue,
+ background = Screen.colors.LightMagenta,
+ },
+ [10] = { background = Screen.colors.LightGrey, underline = true },
+ [11] = {
+ background = Screen.colors.LightGrey,
+ underline = true,
+ bold = true,
+ foreground = Screen.colors.Magenta,
+ },
})
meths.set_option_value('winbar', 'Set Up The Bars', {})
end)
@@ -48,7 +57,7 @@ describe('winbar', function()
eq(1, win_info.winbar)
end)
- it('works with custom \'fillchars\' value', function()
+ it("works with custom 'fillchars' value", function()
command('set fillchars=wbr:+')
screen:expect([[
{1:Set Up The Bars+++++++++++++++++++++++++++++++++++++++++++++}|
@@ -124,7 +133,7 @@ describe('winbar', function()
]])
end)
- it('works when switching value of \'winbar\'', function()
+ it("works when switching value of 'winbar'", function()
command('belowright vsplit | split | split | set winbar=')
screen:expect([[
│^ |
@@ -177,29 +186,35 @@ describe('winbar', function()
just some
random text]]
meths.set_option_value('winbar', 'Hello, I am a ruler: %l,%c', {})
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:Hello, I am a ruler: 2,11 }|
just some |
random tex^t |
{3:~ }|*9
|
- ]]}
+ ]],
+ }
feed 'b'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:Hello, I am a ruler: 2,8 }|
just some |
random ^text |
{3:~ }|*9
|
- ]]}
+ ]],
+ }
feed 'k'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:Hello, I am a ruler: 1,8 }|
just so^me |
random text |
{3:~ }|*9
|
- ]]}
+ ]],
+ }
end)
it('works with laststatus=3', function()
@@ -264,7 +279,7 @@ describe('winbar', function()
{3:~ }|*3
|
]])
- eq({5, 1}, meths.win_get_cursor(0))
+ eq({ 5, 1 }, meths.win_get_cursor(0))
meths.input_mouse('left', 'drag', '', 0, 6, 2)
screen:expect([[
@@ -280,7 +295,7 @@ describe('winbar', function()
{3:~ }|*3
{1:-- VISUAL --} |
]])
- eq({6, 2}, meths.win_get_cursor(0))
+ eq({ 6, 2 }, meths.win_get_cursor(0))
meths.input_mouse('left', 'drag', '', 0, 1, 2)
screen:expect([[
@@ -296,11 +311,11 @@ describe('winbar', function()
{3:~ }|*3
{1:-- VISUAL --} |
]])
- eq({1, 2}, meths.win_get_cursor(0))
+ eq({ 1, 2 }, meths.win_get_cursor(0))
meths.input_mouse('left', 'drag', '', 0, 0, 2)
screen:expect_unchanged()
- eq({1, 2}, meths.win_get_cursor(0))
+ eq({ 1, 2 }, meths.win_get_cursor(0))
end)
it('dragging statusline with mouse works correctly', function()
@@ -398,19 +413,22 @@ describe('winbar', function()
end)
it('requires window-local value for floating windows', function()
- local win = meths.open_win(0, false, { relative = 'editor', row = 2, col = 10, height = 7,
- width = 30 })
+ local win =
+ meths.open_win(0, false, { relative = 'editor', row = 2, col = 10, height = 7, width = 30 })
meths.set_option_value('winbar', 'bar', {})
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:bar }|
^ |
{3:~ }{8: }{3: }|
{3:~ }{9:~ }{3: }|*6
{3:~ }|*3
|
- ]]}
+ ]],
+ }
meths.set_option_value('winbar', 'floaty bar', { scope = 'local', win = win.id })
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:bar }|
^ |
{3:~ }{1:floaty bar }{3: }|
@@ -418,7 +436,8 @@ describe('winbar', function()
{3:~ }{9:~ }{3: }|*5
{3:~ }|*3
|
- ]]}
+ ]],
+ }
end)
it('works correctly when moving a split', function()
@@ -505,10 +524,10 @@ describe('local winbar with tabs', function()
screen = Screen.new(60, 10)
screen:attach()
screen:set_default_attr_ids({
- [1] = {bold = true},
- [2] = {reverse = true},
- [3] = {bold = true, foreground = Screen.colors.Blue},
- [4] = {underline = true, background = Screen.colors.LightGray}
+ [1] = { bold = true },
+ [2] = { reverse = true },
+ [3] = { bold = true, foreground = Screen.colors.Blue },
+ [4] = { underline = true, background = Screen.colors.LightGray },
})
meths.set_option_value('winbar', 'foo', { scope = 'local', win = 0 })
end)
@@ -522,13 +541,15 @@ describe('local winbar with tabs', function()
|
]])
command('tabnext')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1: [No Name] }{4: [No Name] }{2: }{4:X}|
{1:foo }|
^ |
{3:~ }|*6
|
- ]]}
+ ]],
+ }
end)
it('can edit new empty buffer #19458', function()
@@ -536,26 +557,31 @@ describe('local winbar with tabs', function()
some
goofy
text]]
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:foo }|
some |
goofy |
tex^t |
{3:~ }|*5
|
- ]]}
+ ]],
+ }
-- this used to throw an E315 ml_get error
command 'tabedit'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{4: + [No Name] }{1: [No Name] }{2: }{4:X}|
^ |
{3:~ }|*7
|
- ]]}
+ ]],
+ }
command 'tabprev'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1: + [No Name] }{4: [No Name] }{2: }{4:X}|
{1:foo }|
some |
@@ -563,22 +589,28 @@ describe('local winbar with tabs', function()
tex^t |
{3:~ }|*4
|
- ]]}
+ ]],
+ }
end)
end)
it('winbar works properly when redrawing is postponed #23534', function()
- clear({args = {
- '-c', 'set laststatus=2 lazyredraw',
- '-c', 'setlocal statusline=(statusline) winbar=(winbar)',
- '-c', 'call nvim_input(":<Esc>")',
- }})
+ clear({
+ args = {
+ '-c',
+ 'set laststatus=2 lazyredraw',
+ '-c',
+ 'setlocal statusline=(statusline) winbar=(winbar)',
+ '-c',
+ 'call nvim_input(":<Esc>")',
+ },
+ })
local screen = Screen.new(60, 6)
screen:attach()
screen:set_default_attr_ids({
- [0] = {foreground = Screen.colors.Blue, bold = true},
- [1] = {bold = true},
- [2] = {bold = true, reverse = true},
+ [0] = { foreground = Screen.colors.Blue, bold = true },
+ [1] = { bold = true },
+ [2] = { bold = true, reverse = true },
})
screen:expect([[
{1:(winbar) }|