Files
neovim/test/functional/ui/global_statusline_spec.lua
Famiu Haque 5ab1229174 feat: add support for global statusline
Ref: #9342

Adds the option to have a single global statusline for the current window at the bottom of the screen instead of a statusline at the bottom of every window. Enabled by setting `laststatus = 3`.

Due to the fact that statuslines at the bottom of windows are removed when global statusline is enabled, horizontal separators are used instead to separate horizontal splits. The horizontal separator character is configurable through the`horiz` item in `'fillchars'`. Separator connector characters are also used to connect the horizontal and vertical separators together, which are also configurable through the `horizup`, `horizdown`, `vertleft`, `vertright` and `verthoriz` items in `fillchars`.

The window separators are highlighted using the `WinSeparator` highlight group, which supersedes `VertSplit` and is linked to `VertSplit` by default in order to maintain backwards compatibility.
2022-03-18 00:21:41 +06:00

234 lines
14 KiB
Lua

local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, command, feed = helpers.clear, helpers.command, helpers.feed
describe('global statusline', function()
local screen
before_each(function()
clear()
screen = Screen.new(60, 16)
screen:attach()
command('set laststatus=3')
command('set ruler')
end)
it('works', function()
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{2:[No Name] 0,0-1 All}|
|
]], attr_ids={
[1] = {bold = true, foreground = Screen.colors.Blue1};
[2] = {bold = true, reverse = true};
}}
feed('i<CR><CR>')
screen:expect{grid=[[
|
|
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{2:[No Name] [+] 3,1 All}|
{3:-- INSERT --} |
]], attr_ids={
[1] = {bold = true, foreground = Screen.colors.Blue};
[2] = {bold = true, reverse = true};
[3] = {bold = true};
}}
end)
it('works with splits', function()
command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split')
screen:expect{grid=[[
{1:│} {1:│} {1:│}^ |
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:├────────────────┤}{2:~}{1:│}{2:~ }|
{2:~ }{1:│} {1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:├────────────────────}|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│} |
{1:────────────────────┴────────────────┴─┤}{2:~ }|
{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{3:[No Name] 0,0-1 All}|
|
]], attr_ids={
[1] = {reverse = true};
[2] = {bold = true, foreground = Screen.colors.Blue1};
[3] = {bold = true, reverse = true};
}}
end)
it('works when switching between values of laststatus', function()
command('set laststatus=1')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
0,0-1 All |
]], attr_ids={
[1] = {foreground = Screen.colors.Blue, bold = true};
}}
command('set laststatus=3')
screen:expect{grid=[[
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{2:[No Name] 0,0-1 All}|
|
]], attr_ids={
[1] = {foreground = Screen.colors.Blue, bold = true};
[2] = {reverse = true, bold = true};
}}
command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split')
command('set laststatus=2')
screen:expect{grid=[[
{1:│} {1:│} {1:│}^ |
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│< Name] 0,0-1 │}{2:~}{1:│}{2:~ }|
{2:~ }{1:│} {1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{3:<No Name] 0,0-1 All}|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│} |
{1:<No Name] 0,0-1 All < Name] 0,0-1 <│}{2:~ }|
{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{1:[No Name] 0,0-1 All <No Name] 0,0-1 All}|
|
]], attr_ids={
[1] = {reverse = true};
[2] = {foreground = Screen.colors.Blue, bold = true};
[3] = {reverse = true, bold = true};
}}
command('set laststatus=3')
screen:expect{grid=[[
{1:│} {1:│} {1:│}^ |
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:├────────────────┤}{2:~}{1:│}{2:~ }|
{2:~ }{1:│} {1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:├────────────────────}|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│} |
{1:────────────────────┴────────────────┴─┤}{2:~ }|
{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{3:[No Name] 0,0-1 All}|
|
]], attr_ids={
[1] = {reverse = true};
[2] = {foreground = Screen.colors.Blue, bold = true};
[3] = {reverse = true, bold = true};
}}
command('set laststatus=0')
screen:expect{grid=[[
{1:│} {1:│} {1:│}^ |
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│< Name] 0,0-1 │}{2:~}{1:│}{2:~ }|
{2:~ }{1:│} {1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{3:<No Name] 0,0-1 All}|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│} |
{1:<No Name] 0,0-1 All < Name] 0,0-1 <│}{2:~ }|
{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
0,0-1 All |
]], attr_ids={
[1] = {reverse = true};
[2] = {foreground = Screen.colors.Blue, bold = true};
[3] = {reverse = true, bold = true};
}}
command('set laststatus=3')
screen:expect{grid=[[
{1:│} {1:│} {1:│}^ |
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:├────────────────┤}{2:~}{1:│}{2:~ }|
{2:~ }{1:│} {1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:├────────────────────}|
{2:~ }{1:│}{2:~ }{1:│}{2:~}{1:│} |
{1:────────────────────┴────────────────┴─┤}{2:~ }|
{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{2:~ }{1:│}{2:~ }|
{3:[No Name] 0,0-1 All}|
|
]], attr_ids={
[1] = {reverse = true};
[2] = {foreground = Screen.colors.Blue, bold = true};
[3] = {reverse = true, bold = true};
}}
end)
end)