aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/highlight_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/highlight_spec.lua')
-rw-r--r--test/functional/ui/highlight_spec.lua1705
1 files changed, 762 insertions, 943 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 7776e024b0..727dc38829 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -5,9 +5,8 @@ local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, exec = helpers.command, helpers.exec
local eval = helpers.eval
local feed_command, eq = helpers.feed_command, helpers.eq
-local curbufmeths = helpers.curbufmeths
-local funcs = helpers.funcs
-local meths = helpers.meths
+local fn = helpers.fn
+local api = helpers.api
local exec_lua = helpers.exec_lua
describe('colorscheme compatibility', function()
@@ -16,8 +15,8 @@ describe('colorscheme compatibility', function()
end)
it('&t_Co exists and is set to 256 by default', function()
- eq(1, funcs.exists('&t_Co'))
- eq(1, funcs.exists('+t_Co'))
+ eq(1, fn.exists('&t_Co'))
+ eq(1, fn.exists('+t_Co'))
eq('256', eval('&t_Co'))
end)
end)
@@ -30,13 +29,14 @@ describe('highlight: `:syntax manual`', function()
before_each(function()
clear()
- screen = Screen.new(20,5)
+ screen = Screen.new(20, 5)
screen:attach()
- --syntax highlight for vimcscripts "echo"
- screen:set_default_attr_ids( {
- [0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {bold=true, foreground=Screen.colors.Brown}
- } )
+ -- syntax highlight for vimscript's "echo"
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { bold = true, foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Magenta1 },
+ })
end)
after_each(function()
@@ -57,10 +57,8 @@ describe('highlight: `:syntax manual`', function()
command('bn')
feed_command('bp')
screen:expect([[
- {1:^echo} 1 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {1:^echo} {2:1} |
+ {0:~ }|*3
:bp |
]])
end)
@@ -77,20 +75,17 @@ describe('highlight: `:syntax manual`', function()
command('set nohidden')
command('w')
command('silent bn')
- eq("tmp1.vim", eval("fnamemodify(bufname('%'), ':t')"))
+ eq('tmp1.vim', eval("fnamemodify(bufname('%'), ':t')"))
feed_command('silent bp')
- eq("Xtest-functional-ui-highlight.tmp.vim", eval("fnamemodify(bufname('%'), ':t')"))
+ eq('Xtest-functional-ui-highlight.tmp.vim', eval("fnamemodify(bufname('%'), ':t')"))
screen:expect([[
- {1:^echo} 1 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {1:^echo} {2:1} |
+ {0:~ }|*3
:silent bp |
]])
end)
end)
-
describe('highlight defaults', function()
local screen
@@ -98,16 +93,16 @@ describe('highlight defaults', 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};
+ [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()
end)
@@ -116,17 +111,10 @@ describe('highlight defaults', function()
feed_command('sp', 'vsp', 'vsp')
screen:expect([[
^ │ │ |
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
+ {0:~ }│{0:~ }│{0:~ }|*5
{1:[No Name] }{2:[No Name] [No Name] }|
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:[No Name] }|
:vsp |
]])
@@ -134,17 +122,10 @@ describe('highlight defaults', function()
feed('<c-w>j')
screen:expect([[
│ │ |
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
+ {0:~ }│{0:~ }│{0:~ }|*5
{2:[No Name] [No Name] [No Name] }|
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{1:[No Name] }|
:vsp |
]])
@@ -154,51 +135,30 @@ describe('highlight defaults', function()
feed('<c-w>k<c-w>l')
screen:expect([[
│^ │ |
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
+ {0:~ }│{0:~ }│{0:~ }|*5
{2:[No Name] }{1:[No Name] }{2:[No Name] }|
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:[No Name] }|
:vsp |
]])
feed('<c-w>l')
screen:expect([[
│ │^ |
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
+ {0:~ }│{0:~ }│{0:~ }|*5
{2:[No Name] [No Name] }{1:[No Name] }|
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:[No Name] }|
:vsp |
]])
feed('<c-w>h<c-w>h')
screen:expect([[
^ │ │ |
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
- {0:~ }│{0:~ }│{0:~ }|
+ {0:~ }│{0:~ }│{0:~ }|*5
{1:[No Name] }{2:[No Name] [No Name] }|
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:[No Name] }|
:vsp |
]])
@@ -209,8 +169,7 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:-- INSERT --} |
]])
end)
@@ -219,8 +178,7 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
end)
@@ -243,8 +201,7 @@ describe('highlight defaults', function()
feed('i')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
-- INSERT -- |
]])
feed('<esc>')
@@ -253,8 +210,7 @@ describe('highlight defaults', function()
feed('i')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{5:-- INSERT --} |
]])
end)
@@ -266,16 +222,16 @@ describe('highlight defaults', function()
insert('neovim')
screen:expect([[
{6:neovi^m} |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
- feed_command("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
- .. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
+ feed_command(
+ 'hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE'
+ .. ' gui=NONE guifg=NONE guibg=NONE guisp=NONE'
+ )
screen:expect([[
neovi^m |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
end)
@@ -284,18 +240,19 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
- feed_command("hi NonTextAlt guifg=Red")
- feed_command("hi! link NonText NonTextAlt")
- screen:expect([[
+ feed_command('hi NonTextAlt guifg=Red')
+ feed_command('hi! link NonText NonTextAlt')
+ screen:expect(
+ [[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:hi! link NonText NonTextAlt |
- ]], {[0] = {foreground=Screen.colors.Red}})
+ ]],
+ { [0] = { foreground = Screen.colors.Red } }
+ )
end)
it('Cursor after `:hi clear|syntax reset` #6508', function()
@@ -310,90 +267,199 @@ describe('highlight defaults', function()
insert(' ne \t o\tv im ')
screen:expect([[
ne{7:.>----.}o{7:>-----}v{7:..}im{7:*^*¬} |
- {7:~ }|
- {7:~ }|
+ {7:~ }|*2
|
]])
feed_command('highlight Whitespace gui=NONE guifg=#0000FF')
screen:expect([[
ne{8:.>----.}o{8:>-----}v{8:..}im{8:*^*}{7:¬} |
- {7:~ }|
- {7:~ }|
+ {7:~ }|*2
:highlight Whitespace gui=NONE guifg=#0000FF |
]])
end)
it('are sent to UIs', function()
screen:try_resize(53, 4)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
- ]], hl_groups={EndOfBuffer=0, MsgSeparator=1}}
+ ]],
+ hl_groups = { EndOfBuffer = 0, MsgSeparator = 1 },
+ }
command('highlight EndOfBuffer gui=italic')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {9:~ }|
- {9:~ }|
+ {9:~ }|*2
|
- ]], hl_groups={EndOfBuffer=9, MsgSeparator=1}}
+ ]],
+ hl_groups = { EndOfBuffer = 9, MsgSeparator = 1 },
+ }
command('highlight clear EndOfBuffer')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
- ]], hl_groups={EndOfBuffer=0, MsgSeparator=1}}
+ ]],
+ hl_groups = { EndOfBuffer = 0, MsgSeparator = 1 },
+ }
end)
end)
describe('highlight', function()
before_each(clear)
- it('visual', function()
- local screen = Screen.new(20,4)
+ it('Visual', function()
+ local screen = Screen.new(45, 5)
screen:attach()
screen:set_default_attr_ids({
- [1] = {background = Screen.colors.LightGrey},
- [2] = {bold = true, foreground = Screen.colors.Blue1},
- [3] = {bold = true},
+ [1] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
+ [2] = { bold = true, foreground = Screen.colors.Blue },
+ [3] = { bold = true },
+ [4] = { reverse = true, bold = true },
+ [5] = { reverse = true },
+ [6] = { background = Screen.colors.Grey90 },
})
insert([[
line1 foo bar
+ abcdefghijklmnopqrs
+ ABCDEFGHIJKLMNOPQRS
]])
+ feed('gg')
+ command('vsplit')
-- Non-blinking block cursor: does NOT highlight char-at-cursor.
command('set guicursor=a:block-blinkon0')
- feed('gg$vhhh')
+ feed('V')
screen:expect([[
- line1 foo^ {1:bar} |
- |
- {2:~ }|
- {3:-- VISUAL --} |
+ {1: }^l{1:ine1 foo bar} │{1: line1 foo bar} |
+ abcdefghijklmnopqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL LINE --} |
+ ]])
+
+ feed('<Esc>$vhhh')
+ screen:expect([[
+ line1 foo^ {1:bar} │ line1 foo{1: bar} |
+ abcdefghijklmnopqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL --} |
]])
-- Vertical cursor: highlights char-at-cursor. #8983
command('set guicursor=a:block-blinkon175')
screen:expect([[
- line1 foo{1:^ bar} |
- |
- {2:~ }|
- {3:-- VISUAL --} |
+ line1 foo{1:^ bar} │ line1 foo{1: bar} |
+ abcdefghijklmnopqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL --} |
+ ]])
+
+ command('set selection=exclusive')
+ screen:expect([[
+ line1 foo{1:^ ba}r │ line1 foo{1: ba}r |
+ abcdefghijklmnopqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL --} |
+ ]])
+
+ feed('o')
+ screen:expect([[
+ line1 foo{1: ba}^r │ line1 foo{1: ba}r |
+ abcdefghijklmnopqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL --} |
+ ]])
+
+ feed('V')
+ screen:expect([[
+ {1: line1 foo ba^r} │{1: line1 foo bar} |
+ abcdefghijklmnopqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL LINE --} |
+ ]])
+
+ command('set cursorcolumn')
+ feed('<C-V>')
+ screen:expect([[
+ line1 foo{1: ba}^r │ line1 foo{1: ba}r |
+ abcdefghijklmn{6:o}pqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMN{6:O}PQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL BLOCK --} |
+ ]])
+
+ command('set selection&')
+ screen:expect([[
+ line1 foo{1: ba^r} │ line1 foo{1: bar} |
+ abcdefghijklmn{6:o}pqrs │abcdefghijklmnopqrs |
+ ABCDEFGHIJKLMN{6:O}PQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL BLOCK --} |
+ ]])
+
+ feed('^')
+ screen:expect([[
+ {1:^line1 foo }bar │ {1:line1 foo }bar |
+ ab{6:c}defghijklmnopqrs │abcdefghijklmnopqrs |
+ AB{6:C}DEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL BLOCK --} |
+ ]])
+
+ feed('2j')
+ screen:expect([[
+ {1:line1 foo }bar │ {1:line1 foo }bar |
+ ab{1:cdefghijkl}mnopqrs │ab{1:cdefghijkl}mnopqrs |
+ AB{1:^CDEFGHIJKL}MNOPQRS │AB{1:CDEFGHIJKL}MNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL BLOCK --} |
+ ]])
+
+ command('set nocursorcolumn')
+ feed('O')
+ screen:expect([[
+ {1:line1 foo }bar │ {1:line1 foo }bar |
+ ab{1:cdefghijkl}mnopqrs │ab{1:cdefghijkl}mnopqrs |
+ AB{1:CDEFGHIJK^L}MNOPQRS │AB{1:CDEFGHIJKL}MNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL BLOCK --} |
+ ]])
+
+ command('set selection=exclusive')
+ screen:expect([[
+ {1:line1 foo} bar │ {1:line1 foo} bar |
+ ab{1:cdefghijk}lmnopqrs │ab{1:cdefghijk}lmnopqrs |
+ AB{1:CDEFGHIJK}^LMNOPQRS │AB{1:CDEFGHIJK}LMNOPQRS |
+ {4:[No Name] [+] }{5:[No Name] [+] }|
+ {3:-- VISUAL BLOCK --} |
]])
end)
it('cterm=standout gui=standout', function()
- local screen = Screen.new(20,5)
+ local screen = Screen.new(20, 5)
screen:attach()
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue1},
- [2] = {standout = true, bold = true, underline = true,
- background = Screen.colors.Gray90, foreground = Screen.colors.Blue1},
- [3] = {standout = true, underline = true,
- background = Screen.colors.Gray90}
+ [1] = { bold = true, foreground = Screen.colors.Blue1 },
+ [2] = {
+ standout = true,
+ bold = true,
+ underline = true,
+ background = Screen.colors.Gray90,
+ foreground = Screen.colors.Blue1,
+ },
+ [3] = { standout = true, underline = true, background = Screen.colors.Gray90 },
})
feed_command('hi CursorLine cterm=standout,underline gui=standout,underline')
feed_command('set cursorline')
@@ -409,7 +475,7 @@ describe('highlight', function()
end)
it('strikethrough', function()
- local screen = Screen.new(25,6)
+ local screen = Screen.new(25, 6)
screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword foo')
@@ -420,27 +486,34 @@ describe('highlight', function()
foo bar
foobarfoobar
]])
- screen:expect([[
+ screen:expect(
+ [[
{1:foo} |
{1:foo} bar |
foobarfoobar |
^ |
{2:~ }|
|
- ]], {
- [1] = {strikethrough = true},
- [2] = {bold = true, foreground = Screen.colors.Blue1},
- })
+ ]],
+ {
+ [1] = { strikethrough = true },
+ [2] = { bold = true, foreground = Screen.colors.Blue1 },
+ }
+ )
end)
it('nocombine', function()
- local screen = Screen.new(25,6)
- screen:set_default_attr_ids{
- [1] = {foreground = Screen.colors.SlateBlue, underline = true},
- [2] = {bold = true, foreground = Screen.colors.Blue1},
- [3] = {underline = true, reverse = true, foreground = Screen.colors.SlateBlue},
- [4] = {background = Screen.colors.Yellow, reverse = true, foreground = Screen.colors.SlateBlue},
- [5] = {foreground = Screen.colors.Red},
+ local screen = Screen.new(25, 6)
+ screen:set_default_attr_ids {
+ [1] = { foreground = Screen.colors.SlateBlue, underline = true },
+ [2] = { bold = true, foreground = Screen.colors.Blue1 },
+ [3] = { underline = true, reverse = true, foreground = Screen.colors.SlateBlue },
+ [4] = {
+ background = Screen.colors.Yellow,
+ reverse = true,
+ foreground = Screen.colors.SlateBlue,
+ },
+ [5] = { foreground = Screen.colors.Red },
}
screen:attach()
feed_command('syntax on')
@@ -451,37 +524,39 @@ describe('highlight', function()
foobar
foobar
]])
- screen:expect{grid=[[
- {1:foobar} |
- {1:foobar} |
+ screen:expect {
+ grid = [[
+ {1:foobar} |*2
^ |
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
|
- ]]}
+ ]],
+ }
feed('/foo')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{3:foo}{1:bar} |
{4:foo}{1:bar} |
|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
/foo^ |
- ]]}
+ ]],
+ }
feed('<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{4:^foo}{1:bar} |
{4:foo}{1:bar} |
|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{5:search hit...uing at TOP} |
- ]]}
+ ]],
+ }
end)
it('guisp (special/undercurl)', function()
- local screen = Screen.new(25,10)
+ local screen = Screen.new(25, 10)
screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword neovim')
@@ -505,7 +580,8 @@ describe('highlight', function()
specialwithfg
]])
feed('Go<tab>neovim tabbed')
- screen:expect([[
+ screen:expect(
+ [[
{1:neovim} |
awesome {1:neovim} |
wordcontainingneovim |
@@ -516,20 +592,24 @@ describe('highlight', function()
{1:neovim} tabbed^ |
{0:~ }|
{5:-- INSERT --} |
- ]], {
- [0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red,
- special = Screen.colors.Red},
- [2] = {special = Screen.colors.Red},
- [3] = {special = Screen.colors.Red, background = Screen.colors.Yellow},
- [4] = {foreground = Screen.colors.Red, special = Screen.colors.Red},
- [5] = {bold=true},
- })
-
+ ]],
+ {
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = {
+ background = Screen.colors.Yellow,
+ foreground = Screen.colors.Red,
+ special = Screen.colors.Red,
+ },
+ [2] = { special = Screen.colors.Red },
+ [3] = { special = Screen.colors.Red, background = Screen.colors.Yellow },
+ [4] = { foreground = Screen.colors.Red, special = Screen.colors.Red },
+ [5] = { bold = true },
+ }
+ )
end)
it("'diff', syntax and extmark #23722", function()
- local screen = Screen.new(25,10)
+ local screen = Screen.new(25, 10)
screen:attach()
exec([[
new
@@ -539,28 +619,34 @@ describe('highlight', function()
syn match WarningMsg "^.*$"
call nvim_buf_add_highlight(0, -1, 'ErrorMsg', 1, 2, 8)
]])
- screen:expect([[
+ screen:expect(
+ [[
{1: }^ |
{1: }{2:01}{3:234 67}{2:89}{5: }|
- {4:~ }|
- {4:~ }|
+ {4:~ }|*2
{7:[No Name] [+] }|
{1: } |
{1: }{6:-----------------------}|
{4:~ }|
{8:[No Name] }|
|
- ]], {
- [0] = {Screen.colors.WebGray, foreground = Screen.colors.DarkBlue},
- [1] = {background = Screen.colors.Grey, foreground = Screen.colors.Blue4},
- [2] = {foreground = Screen.colors.Red, background = Screen.colors.LightBlue},
- [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.LightBlue},
- [4] = {bold = true, foreground = Screen.colors.Blue},
- [5] = {background = Screen.colors.LightBlue},
- [6] = {bold = true, background = Screen.colors.LightCyan, foreground = Screen.colors.Blue1},
- [7] = {reverse = true, bold = true},
- [8] = {reverse = true},
- })
+ ]],
+ {
+ [0] = { Screen.colors.WebGray, foreground = Screen.colors.DarkBlue },
+ [1] = { background = Screen.colors.Grey, foreground = Screen.colors.Blue4 },
+ [2] = { foreground = Screen.colors.Red, background = Screen.colors.LightBlue },
+ [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.LightBlue },
+ [4] = { bold = true, foreground = Screen.colors.Blue },
+ [5] = { background = Screen.colors.LightBlue },
+ [6] = {
+ bold = true,
+ background = Screen.colors.LightCyan,
+ foreground = Screen.colors.Blue1,
+ },
+ [7] = { reverse = true, bold = true },
+ [8] = { reverse = true },
+ }
+ )
end)
end)
@@ -569,62 +655,55 @@ describe("'listchars' highlight", function()
before_each(function()
clear()
- screen = Screen.new(20,5)
+ screen = Screen.new(20, 5)
screen:attach()
end)
it("'cursorline' and 'cursorcolumn'", function()
screen:set_default_attr_ids({
- [0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {background=Screen.colors.Grey90}
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.Grey90 },
})
feed_command('highlight clear ModeMsg')
feed_command('set cursorline')
feed('i')
screen:expect([[
{1:^ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
-- INSERT -- |
]])
feed('abcdefg<cr>kkasdf')
screen:expect([[
abcdefg |
{1:kkasdf^ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
-- INSERT -- |
]])
feed('<esc>')
screen:expect([[
abcdefg |
{1:kkasd^f }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
feed_command('set nocursorline')
screen:expect([[
abcdefg |
kkasd^f |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:set nocursorline |
]])
feed('k')
screen:expect([[
abcde^fg |
kkasdf |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
:set nocursorline |
]])
feed('jjji<cr><cr><cr><esc>')
screen:expect([[
kkasd |
- |
- |
+ |*2
^f |
|
]])
@@ -650,22 +729,22 @@ describe("'listchars' highlight", function()
it("'cursorline' and with 'listchars' option", function()
screen:set_default_attr_ids({
- [1] = {background=Screen.colors.Grey90},
+ [1] = { background = Screen.colors.Grey90 },
[2] = {
- foreground=Screen.colors.Red,
- background=Screen.colors.Grey90,
+ foreground = Screen.colors.Red,
+ background = Screen.colors.Grey90,
},
[3] = {
- background=Screen.colors.Grey90,
- foreground=Screen.colors.Blue,
- bold=true,
+ background = Screen.colors.Grey90,
+ foreground = Screen.colors.Blue,
+ bold = true,
},
[4] = {
- foreground=Screen.colors.Blue,
- bold=true,
+ foreground = Screen.colors.Blue,
+ bold = true,
},
[5] = {
- foreground=Screen.colors.Red,
+ foreground = Screen.colors.Red,
},
})
feed_command('highlight clear ModeMsg')
@@ -717,8 +796,7 @@ describe("'listchars' highlight", function()
feed('$')
screen:expect([[
{3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
- {4:<} |
- {4:<} |
+ {4:<} |*2
{4:~ }|
:set cursorline |
]])
@@ -734,66 +812,42 @@ describe("'listchars' highlight", function()
it("'listchar' with wrap", function()
screen:set_default_attr_ids({
- [0] = {bold=true, foreground=Screen.colors.Blue},
+ [0] = { bold = true, foreground = Screen.colors.Blue },
})
feed_command('set wrap')
feed_command('set listchars=eol:¬,precedes:< list')
feed('90ia<esc>')
screen:expect([[
{0:<}aaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaa|*2
aaaaaaaaa^a{0:¬} |
|
]])
feed('0')
screen:expect([[
^aaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaa|*3
|
]])
end)
it("'listchar' in visual mode", function()
screen:set_default_attr_ids({
- [1] = {background=Screen.colors.Grey90},
- [2] = {
- foreground=Screen.colors.Red,
- background=Screen.colors.Grey90,
- },
- [3] = {
- background=Screen.colors.Grey90,
- foreground=Screen.colors.Blue,
- bold=true,
- },
- [4] = {
- foreground=Screen.colors.Blue,
- bold=true,
- },
- [5] = {
- foreground=Screen.colors.Red,
- },
- [6] = {
- background=Screen.colors.LightGrey,
- },
- [7] = {
- background=Screen.colors.LightGrey,
- foreground=Screen.colors.Red,
- },
- [8] = {
- background=Screen.colors.LightGrey,
- foreground=Screen.colors.Blue,
- bold=true,
- },
+ [1] = { background = Screen.colors.Grey90 },
+ [2] = { foreground = Screen.colors.Red, background = Screen.colors.Grey90 },
+ [3] = { background = Screen.colors.Grey90, foreground = Screen.colors.Blue, bold = true },
+ [4] = { foreground = Screen.colors.Blue, bold = true },
+ [5] = { foreground = Screen.colors.Red },
+ [6] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
+ [7] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Red },
+ [8] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Blue, bold = true },
})
- feed_command('highlight clear ModeMsg')
- feed_command('highlight Whitespace guifg=#FF0000')
- feed_command('set cursorline')
- feed_command('set tabstop=8')
- feed_command('set nowrap')
- feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ command('highlight clear ModeMsg')
+ command('highlight Whitespace guifg=#FF0000')
+ command('set cursorline')
+ command('set tabstop=8')
+ command('set nowrap')
+ command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0')
screen:expect([[
{2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
@@ -830,10 +884,10 @@ describe("'listchars' highlight", function()
it("'cursorline' with :match", function()
screen:set_default_attr_ids({
- [0] = {bold=true, foreground=Screen.colors.Blue},
- [1] = {background=Screen.colors.Grey90},
- [2] = {foreground=Screen.colors.Red},
- [3] = {foreground=Screen.colors.X11Green, background=Screen.colors.Red1},
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.Grey90 },
+ [2] = { foreground = Screen.colors.Red },
+ [3] = { foreground = Screen.colors.X11Green, background = Screen.colors.Red1 },
})
feed_command('highlight clear ModeMsg')
feed_command('highlight Whitespace guifg=#FF0000')
@@ -842,25 +896,19 @@ describe("'listchars' highlight", function()
feed('ia \t bc \t <esc>')
screen:expect([[
a bc ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]])
feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
screen:expect([[
a{2:.>-----.}bc{2:*>---*^*}{0:¬} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]])
feed_command('match Error /\\s\\+$/')
screen:expect([[
a{2:.>-----.}bc{3:*>---*^*}{0:¬} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]])
end)
@@ -870,15 +918,15 @@ describe('CursorLine and CursorLineNr highlights', function()
before_each(clear)
it('overridden by Error, ColorColumn if fg not set', function()
- local screen = Screen.new(50,5)
+ local screen = Screen.new(50, 5)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.SlateBlue},
- [2] = {bold = true, foreground = Screen.colors.Brown},
- [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [4] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90},
- [5] = {background = Screen.colors.Gray90},
- [6] = {bold = true, foreground = Screen.colors.Blue1},
- [7] = {background = Screen.colors.LightRed},
+ [1] = { foreground = Screen.colors.SlateBlue },
+ [2] = { bold = true, foreground = Screen.colors.Brown },
+ [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90 },
+ [5] = { background = Screen.colors.Gray90 },
+ [6] = { bold = true, foreground = Screen.colors.Blue1 },
+ [7] = { background = Screen.colors.LightRed },
})
screen:attach()
@@ -906,12 +954,12 @@ describe('CursorLine and CursorLineNr highlights', function()
end)
it("overridden by NonText in 'showbreak' characters", function()
- local screen = Screen.new(20,5)
+ local screen = Screen.new(20, 5)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Yellow, background = Screen.colors.Blue};
- [2] = {foreground = Screen.colors.Black, background = Screen.colors.White};
- [3] = {foreground = Screen.colors.Yellow, background = Screen.colors.White};
- [4] = {foreground = Screen.colors.Yellow};
+ [1] = { foreground = Screen.colors.Yellow, background = Screen.colors.Blue },
+ [2] = { foreground = Screen.colors.Black, background = Screen.colors.White },
+ [3] = { foreground = Screen.colors.Yellow, background = Screen.colors.White },
+ [4] = { foreground = Screen.colors.Yellow },
})
screen:attach()
@@ -957,13 +1005,13 @@ describe('CursorLine and CursorLineNr highlights', function()
end)
it("'cursorlineopt' screenline", function()
- local screen = Screen.new(20,5)
+ local screen = Screen.new(20, 5)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Black, background = Screen.colors.White};
- [2] = {foreground = Screen.colors.Yellow};
- [3] = {foreground = Screen.colors.Red, background = Screen.colors.Green};
- [4] = {foreground = Screen.colors.Green, background = Screen.colors.Red};
- [5] = {bold = true}, -- ModeMsg
+ [1] = { foreground = Screen.colors.Black, background = Screen.colors.White },
+ [2] = { foreground = Screen.colors.Yellow },
+ [3] = { foreground = Screen.colors.Red, background = Screen.colors.Green },
+ [4] = { foreground = Screen.colors.Green, background = Screen.colors.Red },
+ [5] = { bold = true }, -- ModeMsg
})
screen:attach()
@@ -1088,16 +1136,16 @@ describe('CursorLine and CursorLineNr highlights', function()
-- oldtest: Test_cursorline_after_yank()
it('always updated. vim-patch:8.1.0849', function()
- local screen = Screen.new(50,5)
+ local screen = Screen.new(50, 5)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.SlateBlue},
- [2] = {bold = true, foreground = Screen.colors.Brown},
- [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [4] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90},
- [5] = {background = Screen.colors.Gray90},
- [6] = {bold = true, foreground = Screen.colors.Blue1},
- [7] = {background = Screen.colors.LightRed},
- [8] = {foreground = Screen.colors.Brown},
+ [1] = { foreground = Screen.colors.SlateBlue },
+ [2] = { bold = true, foreground = Screen.colors.Brown },
+ [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90 },
+ [5] = { background = Screen.colors.Gray90 },
+ [6] = { bold = true, foreground = Screen.colors.Blue1 },
+ [7] = { background = Screen.colors.LightRed },
+ [8] = { foreground = Screen.colors.Brown },
})
screen:attach()
command('set cursorline relativenumber')
@@ -1122,18 +1170,18 @@ describe('CursorLine and CursorLineNr highlights', function()
-- oldtest: Test_cursorline_with_visualmode()
it('with visual area. vim-patch:8.1.1001', function()
- local screen = Screen.new(50,5)
+ local screen = Screen.new(50, 5)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.SlateBlue},
- [2] = {bold = true, foreground = Screen.colors.Brown},
- [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [4] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90},
- [5] = {background = Screen.colors.Gray90},
- [6] = {bold = true, foreground = Screen.colors.Blue1},
- [7] = {background = Screen.colors.LightRed},
- [8] = {foreground = Screen.colors.Brown},
- [9] = {background = Screen.colors.LightGrey},
- [10] = {bold = true},
+ [1] = { foreground = Screen.colors.SlateBlue },
+ [2] = { bold = true, foreground = Screen.colors.Brown },
+ [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90 },
+ [5] = { background = Screen.colors.Gray90 },
+ [6] = { bold = true, foreground = Screen.colors.Blue1 },
+ [7] = { background = Screen.colors.LightRed },
+ [8] = { foreground = Screen.colors.Brown },
+ [9] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
+ [10] = { bold = true },
})
screen:attach()
command('set cursorline')
@@ -1142,8 +1190,7 @@ describe('CursorLine and CursorLineNr highlights', function()
screen:expect([[
{9:abc} |
^a{9:bc} |
- abc |
- abc |
+ abc |*2
{10:-- VISUAL LINE --} |
]])
end)
@@ -1152,8 +1199,8 @@ describe('CursorLine and CursorLineNr highlights', function()
it('is updated if cursor is moved up from timer vim-patch:8.2.4591', function()
local screen = Screen.new(50, 8)
screen:set_default_attr_ids({
- [1] = {background = Screen.colors.Gray90}, -- CursorLine
- [2] = {bold = true, foreground = Screen.colors.Blue1}, -- NonText
+ [1] = { background = Screen.colors.Gray90 }, -- CursorLine
+ [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
})
screen:attach()
exec([[
@@ -1167,40 +1214,41 @@ describe('CursorLine and CursorLineNr highlights', function()
call timer_start(300, 'Func')
]])
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
aaaaa |
bbbbb |
ccccc |
{1:^ddddd }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*3
|
- ]], timeout = 100})
- screen:expect({grid = [[
+ ]],
+ timeout = 100,
+ })
+ screen:expect({
+ grid = [[
aaaaa |
{1:^bbbbb }|
ccccc |
ddddd |
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*3
|
- ]]})
+ ]],
+ })
end)
it('with split windows in diff mode', function()
- local screen = Screen.new(50,12)
+ local screen = Screen.new(50, 12)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
- [2] = {bold = true, background = Screen.colors.Red},
- [3] = {background = Screen.colors.LightMagenta},
- [4] = {reverse = true},
- [5] = {background = Screen.colors.LightBlue},
- [6] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
- [7] = {background = Screen.colors.Red, foreground = Screen.colors.White},
- [8] = {bold = true, foreground = Screen.colors.Blue1},
- [9] = {bold = true, reverse = true},
+ [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
+ [2] = { bold = true, background = Screen.colors.Red },
+ [3] = { background = Screen.colors.LightMagenta },
+ [4] = { reverse = true },
+ [5] = { background = Screen.colors.LightBlue },
+ [6] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 },
+ [7] = { background = Screen.colors.Red, foreground = Screen.colors.White },
+ [8] = { bold = true, foreground = Screen.colors.Blue1 },
+ [9] = { bold = true, reverse = true },
})
screen:attach()
@@ -1210,20 +1258,19 @@ describe('CursorLine and CursorLineNr highlights', function()
feed('<esc>gg')
command('vsplit')
command('enew')
- feed('iline 1 some text<cr>line 2 moRe text!<cr>extra line!<cr>extra line!<cr>extra line!<cr>last line ...<cr>')
+ feed(
+ 'iline 1 some text<cr>line 2 moRe text!<cr>extra line!<cr>extra line!<cr>extra line!<cr>last line ...<cr>'
+ )
feed('<esc>gg')
command('windo diffthis')
screen:expect([[
{1: }{7:line 1 some text }│{1: }{7:^line 1 some text }|
{1: }{3:line 2 mo}{2:Re text!}{3: }│{1: }{3:line 2 mo}{2:re text}{3: }|
{1: }{5:extra line! }│{1: }{6:----------------------}|
- {1: }extra line! │{1: }extra line! |
- {1: }extra line! │{1: }extra line! |
+ {1: }extra line! │{1: }extra line! |*2
{1: }last line ... │{1: }last line ... |
{1: } │{1: } |
- {8:~ }│{8:~ }|
- {8:~ }│{8:~ }|
- {8:~ }│{8:~ }|
+ {8:~ }│{8:~ }|*3
{4:[No Name] [+] }{9:[No Name] [+] }|
|
]])
@@ -1232,13 +1279,10 @@ describe('CursorLine and CursorLineNr highlights', function()
{1: }line 1 some text │{1: }line 1 some text |
{1: }{3:line 2 mo}{2:Re text!}{3: }│{1: }{3:line 2 mo}{2:re text}{3: }|
{1: }{5:extra line! }│{1: }{6:----------------------}|
- {1: }extra line! │{1: }extra line! |
- {1: }extra line! │{1: }extra line! |
+ {1: }extra line! │{1: }extra line! |*2
{1: }last line ... │{1: }last line ... |
{1: }{7: }│{1: }{7:^ }|
- {8:~ }│{8:~ }|
- {8:~ }│{8:~ }|
- {8:~ }│{8:~ }|
+ {8:~ }│{8:~ }|*3
{4:[No Name] [+] }{9:[No Name] [+] }|
|
]])
@@ -1247,50 +1291,52 @@ describe('CursorLine and CursorLineNr highlights', function()
-- Rendered as underline in a diff-line. #9028
command('hi CursorLine ctermbg=red ctermfg=NONE guibg=red guifg=NONE')
feed('kkkk')
- screen:expect([[
+ screen:expect(
+ [[
{1: }line 1 some text │{1: }line 1 some text |
{1: }{11:line 2 mo}{12:Re text!}{11: }│{1: }{11:^line 2 mo}{12:re text}{11: }|
{1: }{5:extra line! }│{1: }{6:----------------------}|
- {1: }extra line! │{1: }extra line! |
- {1: }extra line! │{1: }extra line! |
+ {1: }extra line! │{1: }extra line! |*2
{1: }last line ... │{1: }last line ... |
{1: } │{1: } |
- {8:~ }│{8:~ }|
- {8:~ }│{8:~ }|
- {8:~ }│{8:~ }|
+ {8:~ }│{8:~ }|*3
{4:[No Name] [+] }{9:[No Name] [+] }|
|
- ]], {
- [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
- [2] = {bold = true, background = Screen.colors.Red},
- [3] = {background = Screen.colors.LightMagenta},
- [4] = {reverse = true},
- [5] = {background = Screen.colors.LightBlue},
- [6] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
- [7] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [8] = {bold = true, foreground = Screen.colors.Blue1},
- [9] = {bold = true, reverse = true},
- [10] = {bold = true},
- [11] = {underline = true,
- background = Screen.colors.LightMagenta},
- [12] = {bold = true, underline = true,
- background = Screen.colors.Red},
- })
+ ]],
+ {
+ [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
+ [2] = { bold = true, background = Screen.colors.Red },
+ [3] = { background = Screen.colors.LightMagenta },
+ [4] = { reverse = true },
+ [5] = { background = Screen.colors.LightBlue },
+ [6] = {
+ background = Screen.colors.LightCyan1,
+ bold = true,
+ foreground = Screen.colors.Blue1,
+ },
+ [7] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ [8] = { bold = true, foreground = Screen.colors.Blue1 },
+ [9] = { bold = true, reverse = true },
+ [10] = { bold = true },
+ [11] = { underline = true, background = Screen.colors.LightMagenta },
+ [12] = { bold = true, underline = true, background = Screen.colors.Red },
+ }
+ )
end)
-- oldtest: Test_diff_with_cursorline_number()
it('CursorLineNr shows correctly just below filler lines', function()
- local screen = Screen.new(50,12)
+ local screen = Screen.new(50, 12)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
- [2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
- [3] = {reverse = true},
- [4] = {background = Screen.colors.LightBlue},
- [5] = {background = Screen.colors.Red, foreground = Screen.colors.White},
- [6] = {background = Screen.colors.White, bold = true, foreground = Screen.colors.Black},
- [7] = {bold = true, foreground = Screen.colors.Blue1},
- [8] = {bold = true, reverse = true},
- [9] = {foreground = Screen.colors.Brown},
+ [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
+ [2] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 },
+ [3] = { reverse = true },
+ [4] = { background = Screen.colors.LightBlue },
+ [5] = { background = Screen.colors.Red, foreground = Screen.colors.White },
+ [6] = { background = Screen.colors.White, bold = true, foreground = Screen.colors.Black },
+ [7] = { bold = true, foreground = Screen.colors.Blue1 },
+ [8] = { bold = true, reverse = true },
+ [9] = { foreground = Screen.colors.Brown },
})
screen:attach()
@@ -1308,12 +1354,7 @@ describe('CursorLine and CursorLineNr highlights', function()
{1: }{6: 1 }{5:^foo }│{1: }{6: 2 }{5:foo }|
{1: }{9: 2 }foo │{1: }{9: 3 }foo |
{1: }{9: 3 }bar │{1: }{9: 4 }bar |
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
+ {7:~ }│{7:~ }|*6
{8:[No Name] [+] }{3:[No Name] [+] }|
|
]])
@@ -1323,12 +1364,7 @@ describe('CursorLine and CursorLineNr highlights', function()
{1: }{6: 1 }^foo │{1: }{6: 2 }{5:foo }|
{1: }{9: 2 }foo │{1: }{9: 3 }foo |
{1: }{9: 3 }bar │{1: }{9: 4 }bar |
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
- {7:~ }│{7:~ }|
+ {7:~ }│{7:~ }|*6
{8:[No Name] [+] }{3:[No Name] [+] }|
|
]])
@@ -1341,9 +1377,9 @@ describe('CursorColumn highlight', function()
clear()
screen = Screen.new(50, 8)
screen:set_default_attr_ids({
- [1] = {background = Screen.colors.Gray90}, -- CursorColumn
- [2] = {bold = true, foreground = Screen.colors.Blue1}, -- NonText
- [3] = {bold = true}, -- ModeMsg
+ [1] = { background = Screen.colors.Gray90 }, -- CursorColumn
+ [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
+ [3] = { bold = true }, -- ModeMsg
})
screen:attach()
end)
@@ -1357,44 +1393,28 @@ describe('CursorColumn highlight', function()
screen:expect([[
1234567{1:8}9 |
a ^ b |
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*5
|
]])
feed('i')
screen:expect([[
1{1:2}3456789 |
a^ b |
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*5
{3:-- INSERT --} |
]])
feed('<C-O>')
screen:expect([[
1234567{1:8}9 |
a ^ b |
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*5
{3:-- (insert) --} |
]])
feed('i')
screen:expect([[
1{1:2}3456789 |
a^ b |
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*5
{3:-- INSERT --} |
]])
end)
@@ -1412,26 +1432,27 @@ describe('CursorColumn highlight', function()
call timer_start(300, 'Func')
]])
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
aaaa{1:a} |
bbbb{1:b} |
cccc{1:c} |
dddd^d |
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*3
|
- ]], timeout = 100})
- screen:expect({grid = [[
+ ]],
+ timeout = 100,
+ })
+ screen:expect({
+ grid = [[
^aaaaa |
{1:b}bbbb |
{1:c}cccc |
{1:d}dddd |
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*3
|
- ]]})
+ ]],
+ })
end)
end)
@@ -1442,15 +1463,15 @@ describe('ColorColumn highlight', function()
clear()
screen = Screen.new(40, 15)
screen:set_default_attr_ids({
- [1] = {background = Screen.colors.LightRed}, -- ColorColumn
- [2] = {background = Screen.colors.Grey90}, -- CursorLine
- [3] = {foreground = Screen.colors.Brown}, -- LineNr
- [4] = {foreground = Screen.colors.Brown, bold = true}, -- CursorLineNr
- [5] = {foreground = Screen.colors.Blue, bold = true}, -- NonText
- [6] = {foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true},
- [7] = {reverse = true, bold = true}, -- StatusLine
- [8] = {reverse = true}, -- StatusLineNC
- [9] = {background = Screen.colors.Grey90, foreground = Screen.colors.Red},
+ [1] = { background = Screen.colors.LightRed }, -- ColorColumn
+ [2] = { background = Screen.colors.Grey90 }, -- CursorLine
+ [3] = { foreground = Screen.colors.Brown }, -- LineNr
+ [4] = { foreground = Screen.colors.Brown, bold = true }, -- CursorLineNr
+ [5] = { foreground = Screen.colors.Blue, bold = true }, -- NonText
+ [6] = { foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true },
+ [7] = { reverse = true, bold = true }, -- StatusLine
+ [8] = { reverse = true }, -- StatusLineNC
+ [9] = { background = Screen.colors.Grey90, foreground = Screen.colors.Red },
})
screen:attach()
end)
@@ -1472,16 +1493,12 @@ describe('ColorColumn highlight', function()
{4: 1 }11{1:1}11111{1:1}1 |
{3: 2 }22{1:2}22222{1:2}22 |
{3: 3 }33{1:3}33333{1:3}3 |
- {5:~ }|
- {5:~ }|
- {5:~ }|
+ {5:~ }|*3
{8:X }|
{4: 1 }^11{1:1}11111{1:1}1 |
{3: 2 }22{1:2}22222{1:2}22 |
{3: 3 }33{1:3}33333{1:3}3 |
- {5:~ }|
- {5:~ }|
- {5:~ }|
+ {5:~ }|*3
{7:X }|
|
]])
@@ -1496,18 +1513,7 @@ describe('ColorColumn highlight', function()
screen:expect([[
^The quick brown fox jumped over the {1: }|
{1: } {1:l}azy dogs |
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
+ {5:~ }|*12
|
]])
end)
@@ -1521,18 +1527,7 @@ describe('ColorColumn highlight', function()
screen:expect([[
^The quick brown fox jumped over the laz{1:y}|
{6:+}{5:+}{6:+}{5:>\} dogs |
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
+ {5:~ }|*12
|
]])
end)
@@ -1557,33 +1552,36 @@ describe('ColorColumn highlight', function()
end)
end)
-describe("MsgSeparator highlight and msgsep fillchar", function()
+describe('MsgSeparator highlight and msgsep fillchar', function()
local screen
before_each(function()
clear()
- screen = Screen.new(50,5)
+ screen = Screen.new(50, 5)
screen:set_default_attr_ids({
- [1] = {bold=true, foreground=Screen.colors.Blue},
- [2] = {bold=true, reverse=true},
- [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
- [4] = {background = Screen.colors.Cyan, bold = true, reverse = true},
- [5] = {bold = true, background = Screen.colors.Magenta},
- [6] = {background = Screen.colors.WebGray},
- [7] = {background = Screen.colors.WebGray, bold = true, foreground = Screen.colors.SeaGreen4},
- [8] = {foreground = Screen.colors.Grey0, background = Screen.colors.Gray60},
- [9] = {foreground = Screen.colors.Grey40, background = Screen.colors.Gray60},
- [10] = {foreground = tonumber('0x000019'), background = Screen.colors.Gray60},
- [11] = {background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x666699')},
- [12] = {background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x297d4e')},
- [13] = {background = tonumber('0xff4cff'), bold = true, foreground = tonumber('0xb200ff')},
+ [1] = { bold = true, foreground = Screen.colors.Blue },
+ [2] = { bold = true, reverse = true },
+ [3] = { bold = true, foreground = Screen.colors.SeaGreen4 },
+ [4] = { background = Screen.colors.Cyan, bold = true, reverse = true },
+ [5] = { bold = true, background = Screen.colors.Magenta },
+ [6] = { background = Screen.colors.WebGray },
+ [7] = {
+ background = Screen.colors.WebGray,
+ bold = true,
+ foreground = Screen.colors.SeaGreen4,
+ },
+ [8] = { foreground = Screen.colors.Grey0, background = Screen.colors.Gray60 },
+ [9] = { foreground = Screen.colors.Grey40, background = Screen.colors.Gray60 },
+ [10] = { foreground = tonumber('0x000019'), background = Screen.colors.Gray60 },
+ [11] = { background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x666699') },
+ [12] = { background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x297d4e') },
+ [13] = { background = tonumber('0xff4cff'), bold = true, foreground = tonumber('0xb200ff') },
})
screen:attach()
end)
- it("works", function()
-
+ it('works', function()
-- defaults
- feed_command("ls")
+ feed_command('ls')
screen:expect([[
|
{2: }|
@@ -1593,8 +1591,8 @@ describe("MsgSeparator highlight and msgsep fillchar", function()
]])
feed('<cr>')
- feed_command("set fillchars+=msgsep:-")
- feed_command("ls")
+ feed_command('set fillchars+=msgsep:-')
+ feed_command('ls')
screen:expect([[
|
{2:--------------------------------------------------}|
@@ -1604,8 +1602,8 @@ describe("MsgSeparator highlight and msgsep fillchar", function()
]])
-- linked to StatusLine per default
- feed_command("hi StatusLine guibg=Cyan")
- feed_command("ls")
+ feed_command('hi StatusLine guibg=Cyan')
+ feed_command('ls')
screen:expect([[
|
{4:--------------------------------------------------}|
@@ -1615,9 +1613,9 @@ describe("MsgSeparator highlight and msgsep fillchar", function()
]])
-- but can be unlinked
- feed_command("hi clear MsgSeparator")
- feed_command("hi MsgSeparator guibg=Magenta gui=bold")
- feed_command("ls")
+ feed_command('hi clear MsgSeparator')
+ feed_command('hi MsgSeparator guibg=Magenta gui=bold')
+ feed_command('ls')
screen:expect([[
|
{5:--------------------------------------------------}|
@@ -1627,169 +1625,63 @@ describe("MsgSeparator highlight and msgsep fillchar", function()
]])
end)
- it("and MsgArea", function()
- feed_command("hi MsgArea guibg=Gray")
- screen:expect{grid=[[
+ it('and MsgArea', function()
+ feed_command('hi MsgArea guibg=Gray')
+ screen:expect {
+ grid = [[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{6: }|
- ]]}
- feed(":ls")
- screen:expect{grid=[[
+ ]],
+ }
+ feed(':ls')
+ screen:expect {
+ grid = [[
|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{6::ls^ }|
- ]]}
- feed(":<cr>")
- screen:expect{grid=[[
+ ]],
+ }
+ feed(':<cr>')
+ screen:expect {
+ grid = [[
|
{2: }|
{6::ls: }|
{6: 1 %a "[No Name]" line 1 }|
{7:Press ENTER or type command to continue}{6:^ }|
- ]]}
+ ]],
+ }
-- support madness^Wblending of message "overlay"
- feed_command("hi MsgArea blend=20")
- feed_command("hi clear MsgSeparator")
- feed_command("hi MsgSeparator blend=30 guibg=Magenta")
- screen:expect{grid=[[
+ feed_command('hi MsgArea blend=20')
+ feed_command('hi clear MsgSeparator')
+ feed_command('hi MsgSeparator blend=30 guibg=Magenta')
+ screen:expect {
+ grid = [[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{8::hi}{9: }{8:MsgSeparator}{9: }{8:blend=30}{9: }{8:guibg=Magenta}{9: }|
- ]]}
- feed(":ls")
- screen:expect{grid=[[
+ ]],
+ }
+ feed(':ls')
+ screen:expect {
+ grid = [[
|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{8::ls}{9:^ }|
- ]]}
- feed("<cr>")
- screen:expect{grid=[[
+ ]],
+ }
+ feed('<cr>')
+ screen:expect {
+ grid = [[
|
{13:~ }|
{10::ls}{11: }|
{11:~ }{10:1}{11: }{10:%a}{11: }{10:"[No}{11: }{10:Name]"}{11: }{10:line}{11: }{10:1}{11: }|
{12:Press}{9: }{12:ENTER}{9: }{12:or}{9: }{12:type}{9: }{12:command}{9: }{12:to}{9: }{12:continue}{9:^ }|
- ]]}
- end)
-end)
-
-describe("'number' and 'relativenumber' highlight", function()
- before_each(clear)
-
- it('LineNr, LineNrAbove and LineNrBelow', function()
- local screen = Screen.new(20,10)
- screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Red},
- [2] = {foreground = Screen.colors.Blue},
- [3] = {foreground = Screen.colors.Green},
- })
- screen:attach()
- command('set number relativenumber')
- command('call setline(1, range(50))')
- command('highlight LineNr guifg=Red')
- feed('4j')
- screen:expect([[
- {1: 4 }0 |
- {1: 3 }1 |
- {1: 2 }2 |
- {1: 1 }3 |
- {1:5 }^4 |
- {1: 1 }5 |
- {1: 2 }6 |
- {1: 3 }7 |
- {1: 4 }8 |
- |
- ]])
- command('highlight LineNrAbove guifg=Blue')
- screen:expect([[
- {2: 4 }0 |
- {2: 3 }1 |
- {2: 2 }2 |
- {2: 1 }3 |
- {1:5 }^4 |
- {1: 1 }5 |
- {1: 2 }6 |
- {1: 3 }7 |
- {1: 4 }8 |
- |
- ]])
- command('highlight LineNrBelow guifg=Green')
- screen:expect([[
- {2: 4 }0 |
- {2: 3 }1 |
- {2: 2 }2 |
- {2: 1 }3 |
- {1:5 }^4 |
- {3: 1 }5 |
- {3: 2 }6 |
- {3: 3 }7 |
- {3: 4 }8 |
- |
- ]])
- feed('3j')
- screen:expect([[
- {2: 7 }0 |
- {2: 6 }1 |
- {2: 5 }2 |
- {2: 4 }3 |
- {2: 3 }4 |
- {2: 2 }5 |
- {2: 1 }6 |
- {1:8 }^7 |
- {3: 1 }8 |
- |
- ]])
- end)
-
- -- oldtest: Test_relativenumber_callback()
- it('relative number highlight is updated if cursor is moved from timer', function()
- local screen = Screen.new(50, 8)
- screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown}, -- LineNr
- [2] = {bold = true, foreground = Screen.colors.Blue1}, -- NonText
- })
- screen:attach()
- exec([[
- call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
- set relativenumber
- call cursor(4, 1)
-
- func Func(timer)
- call cursor(1, 1)
- endfunc
-
- call timer_start(300, 'Func')
- ]])
- screen:expect({grid = [[
- {1: 3 }aaaaa |
- {1: 2 }bbbbb |
- {1: 1 }ccccc |
- {1: 0 }^ddddd |
- {2:~ }|
- {2:~ }|
- {2:~ }|
- |
- ]], timeout = 100})
- screen:expect({grid = [[
- {1: 0 }^aaaaa |
- {1: 1 }bbbbb |
- {1: 2 }ccccc |
- {1: 3 }ddddd |
- {2:~ }|
- {2:~ }|
- {2:~ }|
- |
- ]]})
+ ]],
+ }
end)
end)
@@ -1798,54 +1690,57 @@ describe("'winhighlight' highlight", function()
before_each(function()
clear()
- screen = Screen.new(20,8)
+ screen = Screen.new(20, 8)
screen:attach()
screen:set_default_attr_ids {
- [0] = {bold=true, foreground=Screen.colors.Blue};
- [1] = {background = Screen.colors.DarkBlue};
- [2] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1};
- [3] = {bold = true, reverse = true};
- [4] = {reverse = true};
- [5] = {background = Screen.colors.DarkGreen};
- [6] = {background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1};
- [7] = {background = Screen.colors.DarkMagenta};
- [8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1};
- [9] = {foreground = Screen.colors.Brown};
- [10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue};
- [11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true};
- [12] = {background = Screen.colors.DarkGreen, reverse = true};
- [13] = {background = Screen.colors.Magenta4, reverse = true};
- [14] = {background = Screen.colors.DarkBlue, reverse = true};
- [15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
- [16] = {foreground = Screen.colors.Blue1};
- [17] = {background = Screen.colors.LightRed};
- [18] = {background = Screen.colors.Gray90};
- [19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray};
- [20] = {background = Screen.colors.LightGrey, underline = true};
- [21] = {bold = true};
- [22] = {bold = true, foreground = Screen.colors.SeaGreen4};
- [23] = {background = Screen.colors.LightMagenta};
- [24] = {background = Screen.colors.WebGray};
- [25] = {bold = true, foreground = Screen.colors.Green1};
- [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};
- [30] = {background = tonumber('0xff8800')};
- [31] = {background = tonumber('0xff8800'), bold = true, foreground = Screen.colors.Blue};
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.DarkBlue },
+ [2] = { background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1 },
+ [3] = { bold = true, reverse = true },
+ [4] = { reverse = true },
+ [5] = { background = Screen.colors.DarkGreen },
+ [6] = { background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1 },
+ [7] = { background = Screen.colors.DarkMagenta },
+ [8] = {
+ background = Screen.colors.DarkMagenta,
+ bold = true,
+ foreground = Screen.colors.Blue1,
+ },
+ [9] = { foreground = Screen.colors.Brown },
+ [10] = { foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue },
+ [11] = { background = Screen.colors.DarkBlue, bold = true, reverse = true },
+ [12] = { background = Screen.colors.DarkGreen, reverse = true },
+ [13] = { background = Screen.colors.Magenta4, reverse = true },
+ [14] = { background = Screen.colors.DarkBlue, reverse = true },
+ [15] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ [16] = { foreground = Screen.colors.Blue1 },
+ [17] = { background = Screen.colors.LightRed },
+ [18] = { background = Screen.colors.Gray90 },
+ [19] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
+ [20] = { background = Screen.colors.LightGrey, underline = true },
+ [21] = { bold = true },
+ [22] = { bold = true, foreground = Screen.colors.SeaGreen4 },
+ [23] = { background = Screen.colors.LightMagenta },
+ [24] = { background = Screen.colors.WebGray },
+ [25] = { bold = true, foreground = Screen.colors.Green1 },
+ [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 },
+ [30] = { background = tonumber('0xff8800') },
+ [31] = { background = tonumber('0xff8800'), bold = true, foreground = Screen.colors.Blue },
}
- command("hi Background1 guibg=DarkBlue")
- command("hi Background2 guibg=DarkGreen")
+ command('hi Background1 guibg=DarkBlue')
+ command('hi Background2 guibg=DarkGreen')
end)
it('works for background color', function()
- insert("aa")
- command("split")
- command("set winhl=Normal:Background1")
+ insert('aa')
+ command('split')
+ command('set winhl=Normal:Background1')
screen:expect([[
{1:a^a }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{3:[No Name] [+] }|
aa |
{0:~ }|
@@ -1853,11 +1748,10 @@ describe("'winhighlight' highlight", function()
|
]])
- command("enew")
+ command('enew')
screen:expect([[
{1:^ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{3:[No Name] }|
aa |
{0:~ }|
@@ -1874,84 +1768,64 @@ describe("'winhighlight' highlight", function()
command('setlocal winhl=Normal:Background1')
screen:expect([[
{1: ^aa}|
- {2: ~}|
- {2: ~}|
- {2: ~}|
- {2: ~}|
+ {2: ~}|*4
|
]])
command('botright vsplit')
screen:expect([[
{1: aa│ ^aa}|
- {2: ~}{1:│}{2: ~}|
- {2: ~}{1:│}{2: ~}|
- {2: ~}{1:│}{2: ~}|
+ {2: ~}{1:│}{2: ~}|*3
{4:[No Name] [+] }{3:[No Name] [+] }|
|
]])
end)
it('handles undefined groups', function()
- command("set winhl=Normal:Background1")
+ command('set winhl=Normal:Background1')
screen:expect([[
{1:^ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*6
|
]])
- command("set winhl=xxx:yyy")
+ command('set winhl=xxx:yyy')
eq('xxx:yyy', eval('&winhl'))
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
|
- ]]}
+ ]],
+ }
end)
it('can be changed to define different groups', function()
- command("set winhl=EndOfBuffer:Background1")
- screen:expect{grid=[[
+ command('set winhl=EndOfBuffer:Background1')
+ screen:expect {
+ grid = [[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*6
|
- ]]}
+ ]],
+ }
- command("set winhl=Normal:ErrorMsg")
- screen:expect{grid=[[
+ command('set winhl=Normal:ErrorMsg')
+ screen:expect {
+ grid = [[
{15:^ }|
- {29:~ }|
- {29:~ }|
- {29:~ }|
- {29:~ }|
- {29:~ }|
- {29:~ }|
+ {29:~ }|*6
|
- ]]}
+ ]],
+ }
end)
it('works local to the window', function()
- insert("aa")
- command("split")
- command("setlocal winhl=Normal:Background1")
+ insert('aa')
+ command('split')
+ command('setlocal winhl=Normal:Background1')
screen:expect([[
{1:a^a }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{3:[No Name] [+] }|
aa |
{0:~ }|
@@ -1959,11 +1833,10 @@ describe("'winhighlight' highlight", function()
|
]])
- command("enew")
+ command('enew')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
aa |
{0:~ }|
@@ -1971,11 +1844,10 @@ describe("'winhighlight' highlight", function()
|
]])
- command("bnext")
+ command('bnext')
screen:expect([[
{1:^aa }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{3:[No Name] [+] }|
aa |
{0:~ }|
@@ -1985,13 +1857,12 @@ describe("'winhighlight' highlight", function()
end)
it('for inactive window background works', function()
- command("set winhl=Normal:Background1,NormalNC:Background2")
+ command('set winhl=Normal:Background1,NormalNC:Background2')
-- tests global value is copied across split
- command("split")
+ command('split')
screen:expect([[
{1:^ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{3:[No Name] }|
{5: }|
{6:~ }|
@@ -1999,11 +1870,10 @@ describe("'winhighlight' highlight", function()
|
]])
- feed("<c-w><c-w>")
+ feed('<c-w><c-w>')
screen:expect([[
{5: }|
- {6:~ }|
- {6:~ }|
+ {6:~ }|*2
{4:[No Name] }|
{1:^ }|
{2:~ }|
@@ -2011,11 +1881,10 @@ describe("'winhighlight' highlight", function()
|
]])
- feed("<c-w><c-w>")
+ feed('<c-w><c-w>')
screen:expect([[
{1:^ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
{3:[No Name] }|
{5: }|
{6:~ }|
@@ -2025,13 +1894,12 @@ describe("'winhighlight' highlight", function()
end)
it('works with NormalNC', function()
- command("hi NormalNC guibg=DarkMagenta")
+ command('hi NormalNC guibg=DarkMagenta')
-- tests global value is copied across split
- command("split")
+ command('split')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
{7: }|
{8:~ }|
@@ -2039,11 +1907,10 @@ describe("'winhighlight' highlight", function()
|
]])
- command("wincmd w")
+ command('wincmd w')
screen:expect([[
{7: }|
- {8:~ }|
- {8:~ }|
+ {8:~ }|*2
{4:[No Name] }|
^ |
{0:~ }|
@@ -2051,13 +1918,11 @@ describe("'winhighlight' highlight", function()
|
]])
-
-- winbg=Normal:... overrides global NormalNC
- command("set winhl=Normal:Background1")
+ command('set winhl=Normal:Background1')
screen:expect([[
{7: }|
- {8:~ }|
- {8:~ }|
+ {8:~ }|*2
{4:[No Name] }|
{1:^ }|
{2:~ }|
@@ -2065,11 +1930,10 @@ describe("'winhighlight' highlight", function()
|
]])
- command("wincmd w")
+ command('wincmd w')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
{1: }|
{2:~ }|
@@ -2077,12 +1941,11 @@ describe("'winhighlight' highlight", function()
|
]])
- command("wincmd w")
- command("set winhl=Normal:Background1,NormalNC:Background2")
+ command('wincmd w')
+ command('set winhl=Normal:Background1,NormalNC:Background2')
screen:expect([[
{7: }|
- {8:~ }|
- {8:~ }|
+ {8:~ }|*2
{4:[No Name] }|
{1:^ }|
{2:~ }|
@@ -2090,11 +1953,10 @@ describe("'winhighlight' highlight", function()
|
]])
- command("wincmd w")
+ command('wincmd w')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
{5: }|
{6:~ }|
@@ -2104,30 +1966,32 @@ describe("'winhighlight' highlight", function()
end)
it('updates background to changed linked group', function()
- command("split")
- command("setlocal winhl=Normal:FancyGroup") -- does not yet exist
- screen:expect{grid=[[
+ command('split')
+ command('setlocal winhl=Normal:FancyGroup') -- does not yet exist
+ screen:expect {
+ grid = [[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
|
{0:~ }|
{4:[No Name] }|
|
- ]]}
+ ]],
+ }
- command("hi FancyGroup guibg=#FF8800") -- nice orange
- screen:expect{grid=[[
+ command('hi FancyGroup guibg=#FF8800') -- nice orange
+ screen:expect {
+ grid = [[
{30:^ }|
- {31:~ }|
- {31:~ }|
+ {31:~ }|*2
{3:[No Name] }|
|
{0:~ }|
{4:[No Name] }|
|
- ]]}
+ ]],
+ }
end)
it('background applies also to non-text', function()
@@ -2144,10 +2008,7 @@ describe("'winhighlight' highlight", function()
{9: 1 } ^Lorem ipsum do|
{9: } {0:↪}lor sit |
{9: } {0:↪}amet{0:-} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]])
@@ -2156,10 +2017,7 @@ describe("'winhighlight' highlight", function()
{10: 1 }{1: ^Lorem ipsum do}|
{10: }{1: }{2:↪}{1:lor sit }|
{10: }{1: }{2:↪}{1:amet}{2:-}{1: }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*4
|
]])
@@ -2168,12 +2026,7 @@ describe("'winhighlight' highlight", function()
feed('3w')
screen:expect([[
{10: 1 }{2:❮}{1: dolor ^sit ame}{2:❯}|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*6
|
]])
end)
@@ -2188,11 +2041,7 @@ describe("'winhighlight' highlight", function()
screen:expect([[
{25:the} {26:foobar} was {26:fooba}|
{26:^r} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
]])
@@ -2202,28 +2051,22 @@ describe("'winhighlight' highlight", function()
screen:expect([[
{27:the}{1: }{26:foobar}{1: was }{26:fooba}|
{26:^r}{1: }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
- {2:~ }|
+ {2:~ }|*5
|
]])
end)
it('can override NonText, Conceal and EndOfBuffer', function()
- curbufmeths.set_lines(0,-1,true, {"raa\000"})
+ api.nvim_buf_set_lines(0, 0, -1, true, { 'raa\000' })
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
command('set cole=2 cocu=nvic')
command('split')
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
- command('set winhl=SpecialKey:ErrorMsg,EndOfBuffer:Background1,'
- ..'Conceal:Background2')
+ command('set winhl=SpecialKey:ErrorMsg,EndOfBuffer:Background1,' .. 'Conceal:Background2')
screen:expect([[
^r{5:#}a{15:^@} |
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
{3:[No Name] [+] }|
r{19:#}a{16:^@} |
{0:~ }|
@@ -2240,8 +2083,7 @@ describe("'winhighlight' highlight", function()
feed('k')
command('split')
- command('set winhl=LineNr:Background1,CursorColumn:Background2,'
- ..'ColorColumn:ErrorMsg')
+ command('set winhl=LineNr:Background1,CursorColumn:Background2,' .. 'ColorColumn:ErrorMsg')
screen:expect([[
{1: 1 }v{15:e}ry tex^t |
{1: 2 }m{15:o}re tex{5:t} |
@@ -2261,22 +2103,14 @@ describe("'winhighlight' highlight", function()
screen:expect([[
{20: No Name] }{15: No Name]}{20:X}|
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
]])
- command("tabnext")
+ command('tabnext')
screen:expect([[
{21: No Name] }{1: No Name]}{20:X}|
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
]])
end)
@@ -2284,12 +2118,12 @@ describe("'winhighlight' highlight", function()
it('can override popupmenu', function()
insert('word wording wordy')
command('split')
- command('set winhl=Pmenu:Background1,PmenuSel:Background2,'
- ..'PmenuSbar:ErrorMsg,PmenuThumb:Normal')
+ command(
+ 'set winhl=Pmenu:Background1,PmenuSel:Background2,' .. 'PmenuSbar:ErrorMsg,PmenuThumb:Normal'
+ )
screen:expect([[
word wording word^y |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] [+] }|
word wording wordy |
{0:~ }|
@@ -2327,40 +2161,43 @@ describe("'winhighlight' highlight", function()
command('set cursorline number')
command('split')
command('set winhl=CursorLine:Background1')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{28: 1 }{1:^ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
{28: 1 }{18: }|
{0:~ }|
{4:[No Name] }|
|
- ]]}
+ ]],
+ }
command('set winhl=CursorLineNr:Background2,CursorLine:Background1')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{5: 1 }{1:^ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
{28: 1 }{18: }|
{0:~ }|
{4:[No Name] }|
|
- ]]}
+ ]],
+ }
feed('<c-w>w')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{5: 1 }{1: }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{4:[No Name] }|
{28: 1 }{18:^ }|
{0:~ }|
{3:[No Name] }|
|
- ]]}
+ ]],
+ }
end)
it('can override StatusLine and StatusLineNC', function()
@@ -2368,8 +2205,7 @@ describe("'winhighlight' highlight", function()
command('split')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1:[No Name] }|
|
{0:~ }|
@@ -2394,8 +2230,7 @@ describe("'winhighlight' highlight", function()
]])
end)
-
- it("can override syntax groups", function()
+ it('can override syntax groups', function()
command('syntax on')
command('syntax keyword Foobar foobar')
command('syntax keyword Article the')
@@ -2405,17 +2240,14 @@ describe("'winhighlight' highlight", function()
screen:expect([[
{25:the} {26:foobar} was {26:fooba}|
{26:^r} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
]])
command('split')
command('set winhl=Foobar:Background1,Article:ErrorMsg')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{15:the} {1:foobar} was {1:fooba}|
{1:^r} |
{0:~ }|
@@ -2424,21 +2256,23 @@ describe("'winhighlight' highlight", function()
{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=[[
+ screen:expect {
+ grid = [[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
|
{0:~ }|
{4:[No Name] }|
|
- ]]}
+ ]],
+ }
helpers.assert_alive()
end)
@@ -2452,7 +2286,8 @@ describe("'winhighlight' highlight", function()
insert [[
some text
more text]]
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
some text |
more tex^t |
{0:~ }|
@@ -2461,10 +2296,12 @@ describe("'winhighlight' highlight", function()
more text |
{4:[No Name] }{1:1,1 All}|
|
- ]]}
+ ]],
+ }
command 'set winhl=Background1:Background2'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
some text |
more tex^t |
{0:~ }|
@@ -2473,10 +2310,12 @@ describe("'winhighlight' highlight", function()
more text |
{4:[No Name] }{1:1,1 All}|
|
- ]]}
+ ]],
+ }
feed 'k'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
some tex^t |
more text |
{0:~ }|
@@ -2485,7 +2324,8 @@ describe("'winhighlight' highlight", function()
more text |
{4:[No Name] }{1:1,1 All}|
|
- ]]}
+ ]],
+ }
end)
it('can link to empty highlight group', function()
@@ -2493,16 +2333,17 @@ describe("'winhighlight' highlight", function()
command 'set winhl=NormalNC:Normal'
command 'split'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] }|
|
{0:~ }|
{4:[No Name] }|
|
- ]]}
+ ]],
+ }
end)
end)
@@ -2512,97 +2353,82 @@ describe('highlight namespaces', function()
before_each(function()
clear()
- screen = Screen.new(25,10)
+ 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};
- [9] = {foreground = Screen.colors.Blue};
- [10] = {bold = true, foreground = Screen.colors.SeaGreen};
+ [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 },
+ [9] = { foreground = Screen.colors.Blue },
+ [10] = { bold = true, foreground = Screen.colors.SeaGreen },
}
- ns1 = meths.create_namespace 'grungy'
- ns2 = meths.create_namespace 'ultrared'
+ ns1 = api.nvim_create_namespace 'grungy'
+ ns2 = api.nvim_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'})
+ api.nvim_set_hl(ns1, 'Normal', { bg = 'DarkGrey' })
+ api.nvim_set_hl(ns1, 'NonText', { bg = 'DarkOrange4', fg = 'DarkCyan', italic = true })
+ api.nvim_set_hl(ns2, 'Normal', { bg = 'DarkMagenta' })
+ api.nvim_set_hl(ns2, 'NonText', { fg = 'Crimson' })
end)
it('can be used globally', function()
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*8
|
- ]]}
+ ]],
+ }
- meths.set_hl_ns(ns1)
- screen:expect{grid=[[
+ api.nvim_set_hl_ns(ns1)
+ screen:expect {
+ grid = [[
{2:^ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
+ {3:~ }|*8
|
- ]]}
+ ]],
+ }
- meths.set_hl_ns(ns2)
- screen:expect{grid=[[
+ api.nvim_set_hl_ns(ns2)
+ screen:expect {
+ grid = [[
{4:^ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
- {5:~ }|
+ {5:~ }|*8
|
- ]]}
+ ]],
+ }
- meths.set_hl_ns(0)
- screen:expect{grid=[[
+ api.nvim_set_hl_ns(0)
+ screen:expect {
+ grid = [[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*8
|
- ]]}
+ ]],
+ }
end)
it('can be used per window', function()
- local win1 = meths.get_current_win()
+ local win1 = api.nvim_get_current_win()
command 'split'
- local win2 = meths.get_current_win()
+ local win2 = api.nvim_get_current_win()
command 'split'
- meths.win_set_hl_ns(win1, ns1)
- meths.win_set_hl_ns(win2, ns2)
+ api.nvim_win_set_hl_ns(win1, ns1)
+ api.nvim_win_set_hl_ns(win2, ns2)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|
{6:[No Name] }|
@@ -2613,36 +2439,27 @@ describe('highlight namespaces', function()
{3:~ }|
{7:[No Name] }|
|
- ]]}
+ ]],
+ }
end)
it('redraws correctly when ns=0', function()
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*8
|
- ]]}
+ ]],
+ }
- meths.set_hl(0, 'EndOfBuffer', {fg='#333333'})
- screen:expect{grid=[[
+ api.nvim_set_hl(0, 'EndOfBuffer', { fg = '#333333' })
+ screen:expect {
+ grid = [[
^ |
- {8:~ }|
- {8:~ }|
- {8:~ }|
- {8:~ }|
- {8:~ }|
- {8:~ }|
- {8:~ }|
- {8:~ }|
+ {8:~ }|*8
|
- ]]}
+ ]],
+ }
end)
it('winhl does not accept invalid value #24586', function()
@@ -2653,18 +2470,19 @@ describe('highlight namespaces', function()
return { msg, vim.wo[curwin].winhl }
]])
eq({
- "Vim(set):E5248: Invalid character in group name",
- "Normal:Visual",
- },res)
+ 'Vim(set):E5248: Invalid character in group name',
+ 'Normal:Visual',
+ }, res)
end)
it('Normal in set_hl #25474', function()
- meths.set_hl(0, 'Normal', {bg='#333333'})
+ command('highlight Ignore guifg=bg ctermfg=White')
+ api.nvim_set_hl(0, 'Normal', { bg = '#333333' })
command('highlight Ignore')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
{6: }|
|
Ignore {8:xxx} {9:ctermf}|
@@ -2672,6 +2490,7 @@ describe('highlight namespaces', function()
bg |
{10:Press ENTER or type comma}|
{10:nd to continue}^ |
- ]]}
+ ]],
+ }
end)
end)