aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua74
-rw-r--r--test/functional/ui/decorations_spec.lua38
-rw-r--r--test/functional/ui/fold_spec.lua7
-rw-r--r--test/functional/ui/highlight_spec.lua341
-rw-r--r--test/functional/ui/hlstate_spec.lua20
-rw-r--r--test/functional/ui/inccommand_spec.lua17
-rw-r--r--test/functional/ui/inccommand_user_spec.lua347
-rw-r--r--test/functional/ui/input_spec.lua29
-rw-r--r--test/functional/ui/messages_spec.lua13
-rw-r--r--test/functional/ui/mouse_spec.lua2
-rw-r--r--test/functional/ui/output_spec.lua29
-rw-r--r--test/functional/ui/screen.lua8
-rw-r--r--test/functional/ui/statusline_spec.lua2
-rw-r--r--test/functional/ui/winbar_spec.lua134
14 files changed, 767 insertions, 294 deletions
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index 384761ab17..fa5771a8b3 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -24,7 +24,6 @@ before_each(function()
clear()
screen = Screen.new(40, 8)
screen:attach()
- command("set display-=msgsep")
source([[
highlight RBP1 guibg=Red
highlight RBP2 guibg=Yellow
@@ -152,6 +151,7 @@ before_each(function()
SB={foreground = Screen.colors.Blue4},
E={foreground = Screen.colors.Red, background = Screen.colors.Blue},
M={bold = true},
+ MSEP={bold = true, reverse = true};
})
end)
@@ -298,22 +298,22 @@ describe('Command-line coloring', function()
function()
set_color_cb('SplittedMultibyteStart')
start_prompt('echo "«')
- screen:expect([[
- {EOB:~ }|
- {EOB:~ }|
+ screen:expect{grid=[[
+ |
{EOB:~ }|
{EOB:~ }|
+ {MSEP: }|
:echo " |
{ERR:E5405: Chunk 0 start 7 splits multibyte }|
{ERR:character} |
:echo "«^ |
- ]])
+ ]]}
feed('»')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:echo " |
{ERR:E5405: Chunk 0 start 7 splits multibyte }|
{ERR:character} |
@@ -325,10 +325,10 @@ describe('Command-line coloring', function()
set_color_cb('SplittedMultibyteEnd')
start_prompt('echo "«')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:echo " |
{ERR:E5406: Chunk 0 end 7 splits multibyte ch}|
{ERR:aracter} |
@@ -339,10 +339,10 @@ describe('Command-line coloring', function()
set_color_cb('Echoerring')
start_prompt('e')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
: |
{ERR:E5407: Callback has thrown an exception:}|
{ERR: Vim(echoerr):HERE} |
@@ -398,10 +398,10 @@ describe('Command-line coloring', function()
set_color_cb('Throwing')
start_prompt('e')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
: |
{ERR:E5407: Callback has thrown an exception:}|
{ERR: ABC} |
@@ -412,10 +412,10 @@ describe('Command-line coloring', function()
set_color_cb('SplittedMultibyteStart')
start_prompt('let x = "«»«»«»«»«»"')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:let x = " |
{ERR:E5405: Chunk 0 start 10 splits multibyte}|
{ERR: character} |
@@ -453,10 +453,10 @@ describe('Command-line coloring', function()
screen:sleep(500)
feed('<C-c>')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
: |
{ERR:E5407: Callback has thrown an exception:}|
{ERR: Keyboard interrupt} |
@@ -517,11 +517,11 @@ describe('Command-line coloring', function()
set_color_cb('ReturningGlobal', '')
start_prompt('#')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
: |
{ERR:E5400: Callback should return list} |
:#^ |
@@ -531,11 +531,11 @@ describe('Command-line coloring', function()
set_color_cb('ReturningGlobal', {{0, 1, 'Normal'}, 42})
start_prompt('#')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
: |
{ERR:E5401: List item 1 is not a List} |
:#^ |
@@ -545,10 +545,10 @@ describe('Command-line coloring', function()
set_color_cb('ReturningGlobal2', {{0, 1, 'Normal'}, {1}})
start_prompt('+')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:+ |
{ERR:E5402: List item 1 has incorrect length:}|
{ERR: 1 /= 3} |
@@ -559,10 +559,10 @@ describe('Command-line coloring', function()
set_color_cb('ReturningGlobal2', {{0, 1, 'Normal'}, {2, 3, 'Normal'}})
start_prompt('+')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:+ |
{ERR:E5403: Chunk 1 start 2 not in range [1, }|
{ERR:2)} |
@@ -573,10 +573,10 @@ describe('Command-line coloring', function()
set_color_cb('ReturningGlobal2', {{0, 1, 'Normal'}, {1, 3, 'Normal'}})
start_prompt('+')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:+ |
{ERR:E5404: Chunk 1 end 3 not in range (1, 2]}|
|
@@ -800,10 +800,10 @@ describe('Ex commands coloring', function()
it('does not crash when using `n` in debug mode', function()
feed(':debug execute "echo 1"\n')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
Entering Debug mode. Type "cont" to con|
tinue. |
cmd: execute "echo 1" |
@@ -811,8 +811,8 @@ describe('Ex commands coloring', function()
]])
feed('n\n')
screen:expect([[
- {EOB:~ }|
- {EOB:~ }|
+ |
+ {MSEP: }|
Entering Debug mode. Type "cont" to con|
tinue. |
cmd: execute "echo 1" |
@@ -836,10 +836,10 @@ describe('Ex commands coloring', function()
command("cnoremap <expr> x execute('throw 42')[-1]")
feed(':#x')
screen:expect([[
+ |
{EOB:~ }|
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:# |
{ERR:Error detected while processing :} |
{ERR:E605: Exception not caught: 42} |
@@ -847,9 +847,9 @@ describe('Ex commands coloring', function()
]])
feed('<CR>')
screen:expect([[
+ |
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
:# |
{ERR:Error detected while processing :} |
{ERR:E605: Exception not caught: 42} |
@@ -864,9 +864,9 @@ describe('Ex commands coloring', function()
meths.set_var('Nvim_color_cmdline', 42)
feed(':#')
screen:expect([[
+ |
{EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
+ {MSEP: }|
: |
{ERR:E5408: Unable to get g:Nvim_color_cmdlin}|
{ERR:e callback: Vim:E6000: Argument is not a}|
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 9af5d386db..789f1c6487 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -193,7 +193,7 @@ describe('decorations providers', function()
|
]]}
- meths._set_hl_ns(ns1)
+ meths.set_hl_ns(ns1)
screen:expect{grid=[[
{10: 1 }{11:// just to see if there was an accid}|
{10: }{11:ent} |
@@ -219,7 +219,7 @@ describe('decorations providers', function()
local ns2 = a.nvim_create_namespace 'ns2'
a.nvim_set_decoration_provider (ns2, {
on_win = function (_, win, buf)
- a.nvim__set_hl_ns(win == thewin and _G.ns1 or ns2)
+ a.nvim_set_hl_ns_fast(win == thewin and _G.ns1 or ns2)
end;
})
]]
@@ -266,7 +266,7 @@ describe('decorations providers', function()
]]}
meths.set_hl(ns1, 'LinkGroup', {fg = 'Blue'})
- meths._set_hl_ns(ns1)
+ meths.set_hl_ns(ns1)
screen:expect{grid=[[
// just to see if there was an accident |
@@ -302,7 +302,7 @@ describe('decorations providers', function()
]]}
meths.set_hl(ns1, 'LinkGroup', {fg = 'Blue', default=true})
- meths._set_hl_ns(ns1)
+ meths.set_hl_ns(ns1)
feed 'k'
screen:expect{grid=[[
@@ -1681,7 +1681,7 @@ l5
screen:expect{grid=[[
S4S1^l1 |
- S2x l2 |
+ x S2l2 |
S5{1: }l3 |
{1: }l4 |
{1: }l5 |
@@ -1779,6 +1779,34 @@ l5
]]}
end)
+ it('works with priority #19716', function()
+ screen:try_resize(20, 3)
+ insert(example_text)
+ feed 'gg'
+
+ helpers.command('sign define Oldsign text=O3')
+ helpers.command([[exe 'sign place 42 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
+
+ meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S4', priority=100})
+ meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S2', priority=5})
+ meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200})
+ meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1})
+
+ screen:expect{grid=[[
+ S1S2O3S4S5^l1 |
+ {1: }l2 |
+ |
+ ]]}
+
+ -- Check truncation works too
+ meths.win_set_option(0, 'signcolumn', 'auto')
+
+ screen:expect{grid=[[
+ S5^l1 |
+ {1: }l2 |
+ |
+ ]]}
+ end)
end)
describe('decorations: virt_text', function()
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index c79fc2989c..6bb8bb81c6 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -1904,4 +1904,11 @@ describe("folded lines", function()
describe('without ext_multigrid', function()
with_ext_multigrid(false)
end)
+
+ it('no folds remains if :delete makes buffer empty #19671', function()
+ funcs.setline(1, {'foo', 'bar', 'baz'})
+ command('2,3fold')
+ command('%delete')
+ eq(0, funcs.foldlevel(1))
+ end)
end)
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 946129b082..c5f882a831 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -3,9 +3,10 @@ local Screen = require('test.functional.ui.screen')
local os = require('os')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, exec = helpers.command, helpers.exec
-local eval, exc_exec = helpers.eval, helpers.exc_exec
+local eval = helpers.eval
local feed_command, eq = helpers.feed_command, helpers.eq
local curbufmeths = helpers.curbufmeths
+local meths = helpers.meths
describe('colorscheme compatibility', function()
before_each(function()
@@ -92,16 +93,22 @@ describe('highlight defaults', function()
before_each(function()
clear()
screen = Screen.new()
+ screen:set_default_attr_ids {
+ [0] = {bold=true, foreground=Screen.colors.Blue};
+ [1] = {reverse = true, bold = true};
+ [2] = {reverse = true};
+ [3] = {bold = true};
+ [4] = {bold = true, foreground = Screen.colors.SeaGreen};
+ [5] = {foreground = Screen.colors.Red1, background = Screen.colors.WebGreen};
+ [6] = {background = Screen.colors.Red1, foreground = Screen.colors.Grey100};
+ [7] = {foreground = Screen.colors.Red};
+ [8] = {foreground = Screen.colors.Blue};
+ [9] = {italic = true};
+ }
screen:attach()
- command("set display-=msgsep")
end)
it('window status bar', function()
- screen:set_default_attr_ids({
- [0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {reverse = true, bold = true}, -- StatusLine
- [2] = {reverse = true} -- StatusLineNC
- })
feed_command('sp', 'vsp', 'vsp')
screen:expect([[
^ │ │ |
@@ -200,31 +207,29 @@ describe('highlight defaults', function()
^ |
{0:~ }|
{0:~ }|
- {1:-- INSERT --} |
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {bold = true}})
+ {3:-- INSERT --} |
+ ]])
end)
it('end of file markers', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], {[1] = {bold = true, foreground = Screen.colors.Blue}})
+ ]])
end)
it('"wait return" text', function()
screen:try_resize(53, 4)
feed(':ls<cr>')
screen:expect([[
- {0:~ }|
+ {1: }|
:ls |
1 %a "[No Name]" line 1 |
- {1:Press ENTER or type command to continue}^ |
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {bold = true, foreground = Screen.colors.SeaGreen}})
+ {4:Press ENTER or type command to continue}^ |
+ ]])
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)
@@ -237,8 +242,7 @@ describe('highlight defaults', function()
{0:~ }|
{0:~ }|
-- INSERT -- |
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {bold=true}})
+ ]])
feed('<esc>')
feed_command('highlight CustomHLGroup guifg=red guibg=green')
feed_command('highlight link ModeMsg CustomHLGroup')
@@ -247,9 +251,8 @@ describe('highlight defaults', function()
^ |
{0:~ }|
{0:~ }|
- {1:-- INSERT --} |
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
+ {5:-- INSERT --} |
+ ]])
end)
it('can be cleared by assigning NONE', function()
@@ -258,14 +261,11 @@ describe('highlight defaults', function()
feed_command('hi link TmpKeyword ErrorMsg')
insert('neovim')
screen:expect([[
- {1:neovi^m} |
+ {6:neovi^m} |
{0:~ }|
{0:~ }|
|
- ]], {
- [0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {foreground = Screen.colors.White, background = Screen.colors.Red}
- })
+ ]])
feed_command("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
.. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
screen:expect([[
@@ -273,7 +273,7 @@ describe('highlight defaults', function()
{0:~ }|
{0:~ }|
|
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
+ ]])
end)
it('linking updates window highlight immediately #16552', function()
@@ -283,7 +283,7 @@ describe('highlight defaults', function()
{0:~ }|
{0:~ }|
|
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
+ ]])
feed_command("hi NonTextAlt guifg=Red")
feed_command("hi! link NonText NonTextAlt")
screen:expect([[
@@ -305,56 +305,44 @@ describe('highlight defaults', function()
feed_command('set listchars=space:.,tab:>-,trail:*,eol:¬ list')
insert(' ne \t o\tv im ')
screen:expect([[
- ne{0:.>----.}o{0:>-----}v{0:..}im{0:*^*¬} |
- {0:~ }|
- {0:~ }|
+ ne{7:.>----.}o{7:>-----}v{7:..}im{7:*^*¬} |
+ {7:~ }|
+ {7:~ }|
|
- ]], {
- [0] = {foreground=Screen.colors.Red},
- [1] = {foreground=Screen.colors.Blue},
- })
+ ]])
feed_command('highlight Whitespace gui=NONE guifg=#0000FF')
screen:expect([[
- ne{1:.>----.}o{1:>-----}v{1:..}im{1:*^*}{0:¬} |
- {0:~ }|
- {0:~ }|
+ ne{8:.>----.}o{8:>-----}v{8:..}im{8:*^*}{7:¬} |
+ {7:~ }|
+ {7:~ }|
:highlight Whitespace gui=NONE guifg=#0000FF |
- ]], {
- [0] = {foreground=Screen.colors.Red},
- [1] = {foreground=Screen.colors.Blue},
- })
+ ]])
end)
it('are sent to UIs', function()
screen:try_resize(53, 4)
- screen:set_default_attr_ids({
- [0] = {},
- [1] = {bold = true, foreground = Screen.colors.Blue1},
- [2] = {bold = true, reverse = true},
- [3] = {italic=true}
- })
screen:expect{grid=[[
^ |
- {1:~ }|
- {1:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], hl_groups={EndOfBuffer=1, MsgSeparator=2}}
+ ]], hl_groups={EndOfBuffer=0, MsgSeparator=1}}
command('highlight EndOfBuffer gui=italic')
screen:expect{grid=[[
^ |
- {3:~ }|
- {3:~ }|
+ {9:~ }|
+ {9:~ }|
|
- ]], hl_groups={EndOfBuffer=3, MsgSeparator=2}}
+ ]], hl_groups={EndOfBuffer=9, MsgSeparator=1}}
command('highlight clear EndOfBuffer')
screen:expect{grid=[[
^ |
- {1:~ }|
- {1:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], hl_groups={EndOfBuffer=1, MsgSeparator=2}}
+ ]], hl_groups={EndOfBuffer=0, MsgSeparator=1}}
end)
end)
@@ -1788,6 +1776,7 @@ describe("'winhighlight' highlight", function()
[26] = {background = Screen.colors.Red},
[27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
[28] = {bold = true, foreground = Screen.colors.Brown},
+ [29] = {foreground = Screen.colors.Blue1, background = Screen.colors.Red, bold = true};
})
command("hi Background1 guibg=DarkBlue")
command("hi Background2 guibg=DarkGreen")
@@ -1821,7 +1810,7 @@ describe("'winhighlight' highlight", function()
]])
end)
- it('handles invalid values', function()
+ it('handles undefined groups', function()
command("set winhl=Normal:Background1")
screen:expect([[
{1:^ }|
@@ -1834,19 +1823,44 @@ describe("'winhighlight' highlight", function()
|
]])
- eq('Vim(set):E474: Invalid argument: winhl=xxx:yyy',
- exc_exec("set winhl=xxx:yyy"))
- eq('Normal:Background1', eval('&winhl'))
+ command("set winhl=xxx:yyy")
+ eq('xxx:yyy', eval('&winhl'))
screen:expect{grid=[[
- {1:^ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
- ]], unchanged=true}
+ ]]}
+ end)
+
+ it('can be changed to define different groups', function()
+ command("set winhl=EndOfBuffer:Background1")
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ command("set winhl=Normal:ErrorMsg")
+ screen:expect{grid=[[
+ {15:^ }|
+ {29:~ }|
+ {29:~ }|
+ {29:~ }|
+ {29:~ }|
+ {29:~ }|
+ {29:~ }|
+ |
+ ]]}
end)
it('works local to the window', function()
@@ -2271,4 +2285,191 @@ describe("'winhighlight' highlight", function()
|
]])
end)
+
+
+ it("can override syntax groups", function()
+ command('syntax on')
+ command('syntax keyword Foobar foobar')
+ command('syntax keyword Article the')
+ command('hi Foobar guibg=#FF0000')
+ command('hi Article guifg=#00FF00 gui=bold')
+ insert('the foobar was foobar')
+ screen:expect([[
+ {25:the} {26:foobar} was {26:fooba}|
+ {26:^r} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ command('split')
+ command('set winhl=Foobar:Background1,Article:ErrorMsg')
+ screen:expect{grid=[[
+ {15:the} {1:foobar} was {1:fooba}|
+ {1:^r} |
+ {0:~ }|
+ {3:[No Name] [+] }|
+ {25:the} {26:foobar} was {26:fooba}|
+ {26:r} |
+ {4:[No Name] [+] }|
+ |
+ ]]}
+ end)
+
+ it('can be disabled in newly opened window #19823', function()
+ command('split | set winhl=Normal:ErrorMsg | set winhl=')
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
+ |
+ {0:~ }|
+ {4:[No Name] }|
+ |
+ ]]}
+
+ helpers.assert_alive()
+ end)
+end)
+
+describe('highlight namespaces', function()
+ local screen
+ local ns1, ns2
+
+ before_each(function()
+ clear()
+ screen = Screen.new(25,10)
+ screen:attach()
+ screen:set_default_attr_ids {
+ [1] = {foreground = Screen.colors.Blue, bold = true};
+ [2] = {background = Screen.colors.DarkGrey};
+ [3] = {italic = true, foreground = Screen.colors.DarkCyan, background = Screen.colors.DarkOrange4};
+ [4] = {background = Screen.colors.Magenta4};
+ [5] = {background = Screen.colors.Magenta4, foreground = Screen.colors.Crimson};
+ [6] = {bold = true, reverse = true};
+ [7] = {reverse = true};
+ [8] = {foreground = Screen.colors.Gray20};
+ }
+
+ ns1 = meths.create_namespace 'grungy'
+ ns2 = meths.create_namespace 'ultrared'
+
+ meths.set_hl(ns1, 'Normal', {bg='DarkGrey'})
+ meths.set_hl(ns1, 'NonText', {bg='DarkOrange4', fg='DarkCyan', italic=true})
+ meths.set_hl(ns2, 'Normal', {bg='DarkMagenta'})
+ meths.set_hl(ns2, 'NonText', {fg='Crimson'})
+ end)
+
+ it('can be used globally', function()
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ meths.set_hl_ns(ns1)
+ screen:expect{grid=[[
+ {2:^ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ |
+ ]]}
+
+ meths.set_hl_ns(ns2)
+ screen:expect{grid=[[
+ {4:^ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ {5:~ }|
+ |
+ ]]}
+
+ meths.set_hl_ns(0)
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ end)
+
+ it('can be used per window', function()
+ local win1 = meths.get_current_win()
+ command 'split'
+ local win2 = meths.get_current_win()
+ command 'split'
+
+ meths.win_set_hl_ns(win1, ns1)
+ meths.win_set_hl_ns(win2, ns2)
+
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {6:[No Name] }|
+ {4: }|
+ {5:~ }|
+ {7:[No Name] }|
+ {2: }|
+ {3:~ }|
+ {7:[No Name] }|
+ |
+ ]]}
+ end)
+
+ it('redraws correctly when ns=0', function()
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ meths.set_hl(0, 'EndOfBuffer', {fg='#333333'})
+ screen:expect{grid=[[
+ ^ |
+ {8:~ }|
+ {8:~ }|
+ {8:~ }|
+ {8:~ }|
+ {8:~ }|
+ {8:~ }|
+ {8:~ }|
+ {8:~ }|
+ |
+ ]]}
+ end)
end)
diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua
index df7f34aa7f..dc74d6d401 100644
--- a/test/functional/ui/hlstate_spec.lua
+++ b/test/functional/ui/hlstate_spec.lua
@@ -119,13 +119,15 @@ describe('ext_hlstate detailed highlights', function()
[3] = {{bold = true, reverse = true}, {{hi_name = "StatusLine", ui_name = "StatusLine", kind = "ui"}}},
[4] = {{reverse = true}, {{hi_name = "StatusLineNC", ui_name = "StatusLineNC", kind = "ui"}}},
[5] = {{background = Screen.colors.Red, foreground = Screen.colors.Grey100}, {{hi_name = "ErrorMsg", ui_name = "LineNr", kind = "ui"}}},
- [6] = {{bold = true, reverse = true}, {{hi_name = "MsgSeparator", ui_name = "Normal", kind = "ui"}}},
+ [6] = {{bold = true, reverse = true}, {{hi_name = "Normal", ui_name = "Normal", kind = "ui"}}},
[7] = {{foreground = Screen.colors.Brown, bold = true, reverse = true}, {6, 1}},
- [8] = {{foreground = Screen.colors.Blue1, bold = true, reverse = true}, {6, 2}},
- [9] = {{bold = true, foreground = Screen.colors.Brown}, {{hi_name = "Statement", ui_name = "NormalNC", kind = "ui"}}},
+ [8] = {{foreground = Screen.colors.Blue1, bold = true, reverse = true}, {6, 14}},
+ [9] = {{bold = true, foreground = Screen.colors.Brown}, {{hi_name = "NormalNC", ui_name = "NormalNC", kind = "ui"}}},
[10] = {{bold = true, foreground = Screen.colors.Brown}, {9, 1}},
- [11] = {{bold = true, foreground = Screen.colors.Blue1}, {9, 2}},
+ [11] = {{bold = true, foreground = Screen.colors.Blue1}, {9, 14}},
[12] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
+ [13] = {{background = Screen.colors.Red1, foreground = Screen.colors.Gray100}, {{ui_name = "LineNr", kind = "ui", hi_name = "LineNr"}}};
+ [14] = {{bold = true, foreground = Screen.colors.Blue}, {{ui_name = "EndOfBuffer", kind = "ui", hi_name = "EndOfBuffer"}}};
})
command("set