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.lua141
1 files changed, 119 insertions, 22 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index f40f658275..28e4e88326 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -35,7 +35,6 @@ describe('highlight: `:syntax manual`', function()
end)
after_each(function()
- screen:detach()
os.remove('Xtest-functional-ui-highlight.tmp.vim')
end)
@@ -97,10 +96,6 @@ describe('highlight defaults', function()
command("set display-=msgsep")
end)
- after_each(function()
- screen:detach()
- end)
-
it('window status bar', function()
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
@@ -346,17 +341,10 @@ describe('highlight defaults', function()
end)
describe('highlight', function()
- local screen
-
- before_each(function()
- clear()
- screen = Screen.new(25,10)
- screen:attach()
- end)
+ before_each(clear)
it('visual', function()
- screen:detach()
- screen = Screen.new(20,4)
+ local screen = Screen.new(20,4)
screen:attach()
screen:set_default_attr_ids({
[1] = {background = Screen.colors.LightGrey},
@@ -389,8 +377,7 @@ describe('highlight', function()
end)
it('cterm=standout gui=standout', function()
- screen:detach()
- 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},
@@ -413,8 +400,7 @@ describe('highlight', function()
end)
it('strikethrough', function()
- screen:detach()
- screen = Screen.new(25,6)
+ local screen = Screen.new(25,6)
screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword foo')
@@ -438,7 +424,56 @@ describe('highlight', function()
})
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},
+ }
+ screen:attach()
+ feed_command('syntax on')
+ feed_command('hi! Underlined cterm=underline gui=underline')
+ feed_command('syn keyword Underlined foobar')
+ feed_command('hi Search cterm=inverse,nocombine gui=inverse,nocombine')
+ insert([[
+ foobar
+ foobar
+ ]])
+ screen:expect{grid=[[
+ {1:foobar} |
+ {1:foobar} |
+ ^ |
+ {2:~ }|
+ {2:~ }|
+ |
+ ]]}
+
+ feed('/foo')
+ screen:expect{grid=[[
+ {3:foo}{1:bar} |
+ {4:foo}{1:bar} |
+ |
+ {2:~ }|
+ {2:~ }|
+ /foo^ |
+ ]]}
+ feed('<cr>')
+ screen:expect{grid=[[
+ {4:^foo}{1:bar} |
+ {4:foo}{1:bar} |
+ |
+ {2:~ }|
+ {2:~ }|
+ {5:search hit...uing at TOP} |
+ ]]}
+ end)
+
it('guisp (special/undercurl)', function()
+ local screen = Screen.new(25,10)
+ screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword neovim')
feed_command('syn keyword TmpKeyword1 special')
@@ -494,10 +529,6 @@ describe("'listchars' highlight", function()
screen:attach()
end)
- after_each(function()
- screen:detach()
- end)
-
it("'cursorline' and 'cursorcolumn'", function()
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
@@ -657,6 +688,30 @@ describe("'listchars' highlight", function()
]])
end)
+ it("'listchar' with wrap", function()
+ screen:set_default_attr_ids({
+ [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|
+ aaaaaaaaa^a{0:¬} |
+ |
+ ]])
+ feed('0')
+ screen:expect([[
+ ^aaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaa|
+ |
+ ]])
+ end)
+
it("'listchar' in visual mode", function()
screen:set_default_attr_ids({
[1] = {background=Screen.colors.Grey90},
@@ -1131,6 +1186,7 @@ describe("'winhighlight' highlight", function()
[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},
})
command("hi Background1 guibg=DarkBlue")
command("hi Background2 guibg=DarkGreen")
@@ -1543,4 +1599,45 @@ describe("'winhighlight' highlight", function()
{21:-- }{22:match 1 of 3} |
]])
end)
+
+ it('can override CursorLine and CursorLineNr', function()
+ -- CursorLine used to be parsed as CursorLineNr, because strncmp
+ command('set cursorline number')
+ command('split')
+ command('set winhl=CursorLine:Background1')
+ screen:expect{grid=[[
+ {28: 1 }{1:^ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
+ {28: 1 }{18: }|
+ {0:~ }|
+ {4:[No Name] }|
+ |
+ ]]}
+
+ command('set winhl=CursorLineNr:Background2,CursorLine:Background1')
+ screen:expect{grid=[[
+ {5: 1 }{1:^ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
+ {28: 1 }{18: }|
+ {0:~ }|
+ {4:[No Name] }|
+ |
+ ]]}
+
+ feed('<c-w>w')
+ screen:expect{grid=[[
+ {5: 1 }{1: }|
+ {0:~ }|
+ {0:~ }|
+ {4:[No Name] }|
+ {28: 1 }{18:^ }|
+ {0:~ }|
+ {3:[No Name] }|
+ |
+ ]]}
+ end)
end)