2024-04-09 04:26:16 -07:00
|
|
|
local t = require('test.functional.testutil')()
|
2022-05-13 07:47:11 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-08 02:03:20 -07:00
|
|
|
local clear = t.clear
|
|
|
|
local command = t.command
|
|
|
|
local insert = t.insert
|
|
|
|
local api = t.api
|
|
|
|
local eq = t.eq
|
|
|
|
local poke_eventloop = t.poke_eventloop
|
|
|
|
local feed = t.feed
|
|
|
|
local fn = t.fn
|
|
|
|
local pcall_err = t.pcall_err
|
2022-05-13 07:47:11 -07:00
|
|
|
|
|
|
|
describe('winbar', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
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 },
|
2024-02-14 16:49:39 -07:00
|
|
|
[7] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
|
2022-05-27 15:57:20 -07:00
|
|
|
[8] = { background = Screen.colors.LightMagenta },
|
|
|
|
[9] = {
|
|
|
|
bold = true,
|
|
|
|
foreground = Screen.colors.Blue,
|
|
|
|
background = Screen.colors.LightMagenta,
|
|
|
|
},
|
2022-05-29 01:26:55 -07:00
|
|
|
[10] = { background = Screen.colors.LightGrey, underline = true },
|
|
|
|
[11] = {
|
|
|
|
background = Screen.colors.LightGrey,
|
|
|
|
underline = true,
|
|
|
|
bold = true,
|
|
|
|
foreground = Screen.colors.Magenta,
|
|
|
|
},
|
2022-05-13 07:47:11 -07:00
|
|
|
})
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('winbar', 'Set Up The Bars', {})
|
2022-05-13 07:47:11 -07:00
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-13 07:47:11 -07:00
|
|
|
it('works', function()
|
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*10
|
2022-05-13 07:47:11 -07:00
|
|
|
|
|
|
|
|
]])
|
2022-08-24 06:02:45 -07:00
|
|
|
-- winbar is excluded from the heights returned by winheight() and getwininfo()
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(11, fn.winheight(0))
|
2024-01-16 06:26:21 -07:00
|
|
|
local win_info = fn.getwininfo(api.nvim_get_current_win())[1]
|
2022-08-24 06:02:45 -07:00
|
|
|
eq(11, win_info.height)
|
|
|
|
eq(1, win_info.winbar)
|
2022-05-13 07:47:11 -07:00
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-13 07:47:11 -07:00
|
|
|
it("works with custom 'fillchars' value", function()
|
|
|
|
command('set fillchars=wbr:+')
|
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars+++++++++++++++++++++++++++++++++++++++++++++}|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*10
|
2022-05-13 07:47:11 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-13 07:47:11 -07:00
|
|
|
it('works with custom highlight', function()
|
|
|
|
command('hi WinBar guifg=red')
|
|
|
|
screen:expect([[
|
|
|
|
{5:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*10
|
2022-05-13 07:47:11 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-13 07:47:11 -07:00
|
|
|
it('works with splits', function()
|
|
|
|
command('hi WinBar guifg=red')
|
|
|
|
command('hi WinBarNC guifg=blue')
|
|
|
|
command('belowright vsplit | split | split')
|
|
|
|
screen:expect([[
|
|
|
|
{6:Set Up The Bars }│{5:Set Up The Bars }|
|
|
|
|
│^ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{4:[No Name] }|
|
|
|
|
{3:~ }│{6:Set Up The Bars }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{2:[No Name] }|
|
|
|
|
{3:~ }│{6:Set Up The Bars }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{2:[No Name] [No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
2023-04-13 03:17:05 -07:00
|
|
|
-- 'showcmdloc' "statusline" should not interfere with winbar redrawing #23030
|
|
|
|
command('set showcmd showcmdloc=statusline')
|
|
|
|
feed('<C-W>w')
|
|
|
|
feed('<C-W>')
|
|
|
|
screen:expect([[
|
|
|
|
{6:Set Up The Bars }│{6:Set Up The Bars }|
|
|
|
|
│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{2:[No Name] }|
|
|
|
|
{3:~ }│{5:Set Up The Bars }|
|
|
|
|
{3:~ }│^ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{4:[No Name] ^W }|
|
|
|
|
{3:~ }│{6:Set Up The Bars }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{2:[No Name] [No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('w<C-W>W')
|
|
|
|
screen:expect([[
|
|
|
|
{6:Set Up The Bars }│{6:Set Up The Bars }|
|
|
|
|
│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{2:[No Name] }|
|
|
|
|
{3:~ }│{5:Set Up The Bars }|
|
|
|
|
{3:~ }│^ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{4:[No Name] }|
|
|
|
|
{3:~ }│{6:Set Up The Bars }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{2:[No Name] [No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
2022-05-13 07:47:11 -07:00
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-13 07:47:11 -07:00
|
|
|
it("works when switching value of 'winbar'", function()
|
|
|
|
command('belowright vsplit | split | split | set winbar=')
|
|
|
|
screen:expect([[
|
|
|
|
│^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }│{3:~ }|*2
|
2022-05-13 07:47:11 -07:00
|
|
|
{3:~ }│{4:[No Name] }|
|
|
|
|
{3:~ }│ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }│{3:~ }|*2
|
2022-05-13 07:47:11 -07:00
|
|
|
{3:~ }│{2:[No Name] }|
|
|
|
|
{3:~ }│ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }│{3:~ }|*2
|
2022-05-13 07:47:11 -07:00
|
|
|
{2:[No Name] [No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('set winbar=All\\ Your\\ Bar\\ Are\\ Belong\\ To\\ Us')
|
|
|
|
screen:expect([[
|
|
|
|
{1:All Your Bar Are Belong To Us}│{1:All Your Bar Are Belong To Us }|
|
|
|
|
│^ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{4:[No Name] }|
|
|
|
|
{3:~ }│{1:All Your Bar Are Belong To Us }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{2:[No Name] }|
|
|
|
|
{3:~ }│{1:All Your Bar Are Belong To Us }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{2:[No Name] [No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('set winbar=Changed\\ winbar')
|
|
|
|
screen:expect([[
|
|
|
|
{1:Changed winbar }│{1:Changed winbar }|
|
|
|
|
│^ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{4:[No Name] }|
|
|
|
|
{3:~ }│{1:Changed winbar }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }│{2:[No Name] }|
|
|
|
|
{3:~ }│{1:Changed winbar }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{2:[No Name] [No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-19 15:15:47 -07:00
|
|
|
it('can be ruler', function()
|
|
|
|
insert [[
|
|
|
|
just some
|
|
|
|
random text]]
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('winbar', 'Hello, I am a ruler: %l,%c', {})
|
2022-05-19 15:15:47 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
{1:Hello, I am a ruler: 2,11 }|
|
|
|
|
just some |
|
|
|
|
random tex^t |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*9
|
2022-05-19 15:15:47 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed 'b'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
{1:Hello, I am a ruler: 2,8 }|
|
|
|
|
just some |
|
|
|
|
random ^text |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*9
|
2022-05-19 15:15:47 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed 'k'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
{1:Hello, I am a ruler: 1,8 }|
|
|
|
|
just so^me |
|
|
|
|
random text |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*9
|
2022-05-19 15:15:47 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
2022-05-13 07:47:11 -07:00
|
|
|
it('works with laststatus=3', function()
|
|
|
|
command('set laststatus=3')
|
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*9
|
2022-05-13 07:47:11 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('belowright vsplit | split | split')
|
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }│{1:Set Up The Bars }|
|
|
|
|
│^ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }├──────────────────────────────|
|
|
|
|
{3:~ }│{1:Set Up The Bars }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{3:~ }├──────────────────────────────|
|
|
|
|
{3:~ }│{1:Set Up The Bars }|
|
|
|
|
{3:~ }│ |
|
|
|
|
{3:~ }│{3:~ }|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
2022-05-29 01:26:55 -07:00
|
|
|
-- Test for issue #18791
|
|
|
|
command('tabnew')
|
|
|
|
screen:expect([[
|
|
|
|
{10: }{11:4}{10: [No Name] }{1: [No Name] }{2: }{10:X}|
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*8
|
2022-05-29 01:26:55 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
2022-05-13 07:47:11 -07:00
|
|
|
end)
|
2022-05-19 04:11:11 -07:00
|
|
|
|
|
|
|
it('mouse click and drag work correctly in buffer', function()
|
|
|
|
insert([[
|
2022-05-18 08:15:34 -07:00
|
|
|
line 1
|
|
|
|
line 2
|
|
|
|
line 3
|
|
|
|
line 4
|
|
|
|
line -42
|
|
|
|
line i
|
|
|
|
line sin(theta)
|
2022-05-19 04:11:11 -07:00
|
|
|
line 8]])
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 5, 1)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
line 1 |
|
|
|
|
line 2 |
|
|
|
|
line 3 |
|
|
|
|
line 4 |
|
|
|
|
l^ine -42 |
|
|
|
|
line i |
|
|
|
|
line sin(theta) |
|
|
|
|
line 8 |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*3
|
2022-05-19 04:11:11 -07:00
|
|
|
|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
eq({ 5, 1 }, api.nvim_win_get_cursor(0))
|
2022-05-19 04:11:11 -07:00
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 6, 2)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
line 1 |
|
|
|
|
line 2 |
|
|
|
|
line 3 |
|
|
|
|
line 4 |
|
|
|
|
l{7:ine -42} |
|
|
|
|
{7:li}^ne i |
|
|
|
|
line sin(theta) |
|
|
|
|
line 8 |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*3
|
2022-05-19 04:11:11 -07:00
|
|
|
{1:-- VISUAL --} |
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
eq({ 6, 2 }, api.nvim_win_get_cursor(0))
|
2022-05-19 04:11:11 -07:00
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 1, 2)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
li^n{7:e 1} |
|
|
|
|
{7:line 2} |
|
|
|
|
{7:line 3} |
|
|
|
|
{7:line 4} |
|
|
|
|
{7:li}ne -42 |
|
|
|
|
line i |
|
|
|
|
line sin(theta) |
|
|
|
|
line 8 |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*3
|
2022-05-19 04:11:11 -07:00
|
|
|
{1:-- VISUAL --} |
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
eq({ 1, 2 }, api.nvim_win_get_cursor(0))
|
2022-05-19 04:11:11 -07:00
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 0, 2)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect_unchanged()
|
2024-01-12 10:59:57 -07:00
|
|
|
eq({ 1, 2 }, api.nvim_win_get_cursor(0))
|
2022-05-19 04:11:11 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('dragging statusline with mouse works correctly', function()
|
|
|
|
command('split')
|
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*3
|
2022-05-19 04:11:11 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*3
|
2022-05-19 04:11:11 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 1, 5, 10)
|
2022-05-19 04:11:11 -07:00
|
|
|
poke_eventloop()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 1, 6, 10)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*4
|
2022-05-19 04:11:11 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*2
|
2022-05-19 04:11:11 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 1, 4, 10)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*2
|
2022-05-19 04:11:11 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*4
|
2022-05-19 04:11:11 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 1, 11, 10)
|
2022-05-19 04:11:11 -07:00
|
|
|
poke_eventloop()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 1, 9, 10)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*2
|
2022-05-19 04:11:11 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*2
|
2022-05-19 04:11:11 -07:00
|
|
|
{2:[No Name] }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|*3
|
2022-05-19 04:11:11 -07:00
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(3, api.nvim_get_option_value('cmdheight', {}))
|
2022-05-19 04:11:11 -07:00
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 1, 11, 10)
|
2022-05-19 04:11:11 -07:00
|
|
|
screen:expect([[
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*2
|
2022-05-19 04:11:11 -07:00
|
|
|
{4:[No Name] }|
|
|
|
|
{1:Set Up The Bars }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*4
|
2022-05-19 04:11:11 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
2022-05-18 08:15:34 -07:00
|
|
|
end)
|
2022-05-27 15:57:20 -07:00
|
|
|
|
2022-05-18 12:09:52 -07:00
|
|
|
it('properly equalizes window height for window-local value', function()
|
|
|
|
command('set equalalways | set winbar= | setlocal winbar=a | split')
|
|
|
|
command('setlocal winbar= | split')
|
|
|
|
command('setlocal winbar=b | split')
|
|
|
|
screen:expect([[
|
|
|
|
{1:b }|
|
|
|
|
^ |
|
|
|
|
{4:[No Name] }|
|
|
|
|
{1:b }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
{3:~ }|
|
|
|
|
{2:[No Name] }|
|
|
|
|
{1:a }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-27 15:57:20 -07:00
|
|
|
|
|
|
|
it('requires window-local value for floating windows', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
local win = api.nvim_open_win(
|
2024-01-12 05:44:54 -07:00
|
|
|
0,
|
|
|
|
false,
|
|
|
|
{ relative = 'editor', row = 2, col = 10, height = 7, width = 30 }
|
|
|
|
)
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('winbar', 'bar', {})
|
2022-05-27 15:57:20 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
{1:bar }|
|
|
|
|
^ |
|
|
|
|
{3:~ }{8: }{3: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }{9:~ }{3: }|*6
|
|
|
|
{3:~ }|*3
|
2022-05-27 15:57:20 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
2024-01-16 06:26:21 -07:00
|
|
|
api.nvim_set_option_value('winbar', 'floaty bar', { scope = 'local', win = win })
|
2022-05-27 15:57:20 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
{1:bar }|
|
|
|
|
^ |
|
|
|
|
{3:~ }{1:floaty bar }{3: }|
|
|
|
|
{3:~ }{8: }{3: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }{9:~ }{3: }|*5
|
|
|
|
{3:~ }|*3
|
2022-05-27 15:57:20 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2022-05-28 00:12:42 -07:00
|
|
|
|
|
|
|
it('works correctly when moving a split', function()
|
|
|
|
screen:try_resize(45, 6)
|
|
|
|
command('set winbar=')
|
|
|
|
command('vsplit')
|
|
|
|
command('setlocal winbar=foo')
|
|
|
|
screen:expect([[
|
|
|
|
{1:foo }│ |
|
|
|
|
^ │{3:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }│{3:~ }|*2
|
2022-05-28 00:12:42 -07:00
|
|
|
{4:[No Name] }{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('wincmd L')
|
|
|
|
screen:expect([[
|
|
|
|
│{1:foo }|
|
|
|
|
{3:~ }│^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }│{3:~ }|*2
|
2022-05-28 00:12:42 -07:00
|
|
|
{2:[No Name] }{4:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('wincmd w')
|
|
|
|
command('wincmd L')
|
|
|
|
screen:expect([[
|
|
|
|
{1:foo }│^ |
|
|
|
|
│{3:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }│{3:~ }|*2
|
2022-05-28 00:12:42 -07:00
|
|
|
{2:[No Name] }{4:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-27 23:58:09 -07:00
|
|
|
|
|
|
|
it('properly resizes window when there is no space in it', function()
|
|
|
|
command('set winbar= | 1split')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*8
|
2022-05-27 23:58:09 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('set winbar=a')
|
|
|
|
screen:expect([[
|
|
|
|
{1:a }|
|
|
|
|
^ |
|
|
|
|
{4:[No Name] }|
|
|
|
|
{1:a }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{3:~ }|*6
|
2022-05-27 23:58:09 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('cannot be added unless there is room', function()
|
|
|
|
command('set winbar= | split | split | split | split | split')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
eq('Vim(set):E36: Not enough room', pcall_err(command, 'set winbar=test'))
|
|
|
|
end)
|
2022-05-13 07:47:11 -07:00
|
|
|
end)
|
2022-07-20 00:58:57 -07:00
|
|
|
|
2022-08-13 01:45:21 -07:00
|
|
|
describe('local winbar with tabs', function()
|
|
|
|
local screen
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(60, 10)
|
|
|
|
screen:attach()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 })
|
2022-08-13 01:45:21 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works', function()
|
|
|
|
command('tabnew')
|
|
|
|
screen:expect([[
|
2024-03-26 13:23:36 -07:00
|
|
|
{24: [No Name] }{5: [No Name] }{2: }{24:X}|
|
2022-08-13 01:45:21 -07:00
|
|
|
^ |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*7
|
2022-08-13 01:45:21 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('tabnext')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5: [No Name] }{24: [No Name] }{2: }{24:X}|
|
|
|
|
{5:foo }|
|
2022-08-13 01:45:21 -07:00
|
|
|
^ |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*6
|
2022-08-13 01:45:21 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can edit new empty buffer #19458', function()
|
|
|
|
insert [[
|
|
|
|
some
|
|
|
|
goofy
|
|
|
|
text]]
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:foo }|
|
2022-08-13 01:45:21 -07:00
|
|
|
some |
|
|
|
|
goofy |
|
|
|
|
tex^t |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*5
|
2022-08-13 01:45:21 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
-- this used to throw an E315 ml_get error
|
|
|
|
command 'tabedit'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{24: + [No Name] }{5: [No Name] }{2: }{24:X}|
|
2022-08-13 01:45:21 -07:00
|
|
|
^ |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*7
|
2022-08-13 01:45:21 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
command 'tabprev'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5: + [No Name] }{24: [No Name] }{2: }{24:X}|
|
|
|
|
{5:foo }|
|
2022-08-13 01:45:21 -07:00
|
|
|
some |
|
|
|
|
goofy |
|
|
|
|
tex^t |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*4
|
2022-08-13 01:45:21 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2022-07-20 00:58:57 -07:00
|
|
|
end)
|
2023-05-08 01:25:03 -07:00
|
|
|
|
|
|
|
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>")',
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2023-05-08 01:25:03 -07:00
|
|
|
})
|
|
|
|
local screen = Screen.new(60, 6)
|
|
|
|
screen:attach()
|
|
|
|
screen:expect([[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:(winbar) }|
|
2023-05-08 01:25:03 -07:00
|
|
|
^ |
|
2024-03-26 13:23:36 -07:00
|
|
|
{1:~ }|*2
|
|
|
|
{3:(statusline) }|
|
2023-05-08 01:25:03 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|