mirror of
https://github.com/neovim/neovim.git
synced 2026-08-31 03:13:48 +00:00
feat(ui): add 'winbar'
Adds support for a bar at the top of each window, enabled through the `'winbar'` option. Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
This commit is contained in:
@@ -3102,6 +3102,19 @@ describe('API', function()
|
||||
'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight',
|
||||
{ use_tabline = true, highlights = true }))
|
||||
end)
|
||||
it('works with winbar', function()
|
||||
eq({
|
||||
str = 'TextWithNoHighlightTextWithWarningHighlight',
|
||||
width = 43,
|
||||
highlights = {
|
||||
{ start = 0, group = 'WinBar' },
|
||||
{ start = 19, group = 'WarningMsg' }
|
||||
}
|
||||
},
|
||||
meths.eval_statusline(
|
||||
'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight',
|
||||
{ use_winbar = true, highlights = true }))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
describe('nvim_parse_cmd', function()
|
||||
|
||||
@@ -212,10 +212,10 @@ describe('ui/cursor', function()
|
||||
if m.blinkwait then m.blinkwait = 700 end
|
||||
end
|
||||
if m.hl_id then
|
||||
m.hl_id = 62
|
||||
m.hl_id = 64
|
||||
m.attr = {background = Screen.colors.DarkGray}
|
||||
end
|
||||
if m.id_lm then m.id_lm = 63 end
|
||||
if m.id_lm then m.id_lm = 65 end
|
||||
end
|
||||
|
||||
-- Assert the new expectation.
|
||||
|
||||
180
test/functional/ui/winbar_spec.lua
Normal file
180
test/functional/ui/winbar_spec.lua
Normal file
@@ -0,0 +1,180 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
|
||||
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},
|
||||
})
|
||||
command('set winbar=Set\\ Up\\ The\\ Bars')
|
||||
end)
|
||||
it('works', function()
|
||||
screen:expect([[
|
||||
{1:Set Up The Bars }|
|
||||
^ |
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
it('works with custom \'fillchars\' value', function()
|
||||
command('set fillchars=wbr:+')
|
||||
screen:expect([[
|
||||
{1:Set Up The Bars+++++++++++++++++++++++++++++++++++++++++++++}|
|
||||
^ |
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
it('works with custom highlight', function()
|
||||
command('hi WinBar guifg=red')
|
||||
screen:expect([[
|
||||
{5:Set Up The Bars }|
|
||||
^ |
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
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] }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
it('works when switching value of \'winbar\'', function()
|
||||
command('belowright vsplit | split | split | set winbar=')
|
||||
screen:expect([[
|
||||
│^ |
|
||||
{3:~ }│{3:~ }|
|
||||
{3:~ }│{3:~ }|
|
||||
{3:~ }│{4:[No Name] }|
|
||||
{3:~ }│ |
|
||||
{3:~ }│{3:~ }|
|
||||
{3:~ }│{3:~ }|
|
||||
{3:~ }│{2:[No Name] }|
|
||||
{3:~ }│ |
|
||||
{3:~ }│{3:~ }|
|
||||
{3:~ }│{3:~ }|
|
||||
{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)
|
||||
it('works with laststatus=3', function()
|
||||
command('set laststatus=3')
|
||||
screen:expect([[
|
||||
{1:Set Up The Bars }|
|
||||
^ |
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{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] }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user