aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/bufhl_spec.lua60
-rw-r--r--test/functional/ui/highlight_spec.lua53
2 files changed, 110 insertions, 3 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index d7269d2c29..af709cd521 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -534,6 +534,62 @@ describe('Buffer highlighting', function()
]]}
end)
+ it('respects priority', function()
+ local set_extmark = curbufmeths.set_extmark
+ local id = meths.create_namespace('')
+ insert [[foobar]]
+
+ set_extmark(id, 0, 0, {
+ end_line = 0,
+ end_col = 5,
+ hl_group = "Statement",
+ priority = 100
+ })
+ set_extmark(id, 0, 0, {
+ end_line = 0,
+ end_col = 6,
+ hl_group = "String",
+ priority = 1
+ })
+
+ screen:expect [[
+ {3:fooba}{2:^r} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]
+
+ clear_namespace(id, 0, -1)
+
+ set_extmark(id, 0, 0, {
+ end_line = 0,
+ end_col = 6,
+ hl_group = "String",
+ priority = 1
+ })
+ set_extmark(id, 0, 0, {
+ end_line = 0,
+ end_col = 5,
+ hl_group = "Statement",
+ priority = 100
+ })
+
+ screen:expect [[
+ {3:fooba}{2:^r} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]
+ end)
+
it('works with multibyte text', function()
insert([[
Ta båten över sjön!]])
@@ -699,12 +755,12 @@ describe('Buffer highlighting', function()
-- TODO: only a virtual text from the same ns curretly overrides
-- an existing virtual text. We might add a prioritation system.
set_virtual_text(id1, 0, s1, {})
- eq({{1, 0, 0, {virt_text = s1}}}, get_extmarks(id1, {0,0}, {0, -1}, {details=true}))
+ eq({{1, 0, 0, { priority = 0, virt_text = s1}}}, get_extmarks(id1, {0,0}, {0, -1}, {details=true}))
-- TODO: is this really valid? shouldn't the max be line_count()-1?
local lastline = line_count()
set_virtual_text(id1, line_count(), s2, {})
- eq({{3, lastline, 0, {virt_text = s2}}}, get_extmarks(id1, {lastline,0}, {lastline, -1}, {details=true}))
+ eq({{3, lastline, 0, { priority = 0, virt_text = s2}}}, get_extmarks(id1, {lastline,0}, {lastline, -1}, {details=true}))
eq({}, get_extmarks(id1, {lastline+9000,0}, {lastline+9000, -1}, {}))
end)
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 28e4e88326..ef3acd7d2e 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -604,7 +604,7 @@ describe("'listchars' highlight", function()
]])
end)
- it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function()
+ it("'cursorline' and with 'listchars' option", function()
screen:set_default_attr_ids({
[1] = {background=Screen.colors.Grey90},
[2] = {
@@ -861,6 +861,57 @@ describe('CursorLine highlight', function()
]])
end)
+ it("overridden by NonText in 'showbreak' characters", function()
+ 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};
+ })
+ screen:attach()
+
+ feed_command('set wrap cursorline')
+ feed_command('set showbreak=>>>')
+ feed_command('highlight clear NonText')
+ feed_command('highlight clear CursorLine')
+ feed_command('highlight NonText guifg=Yellow guibg=Blue gui=NONE')
+ feed_command('highlight CursorLine guifg=Black guibg=White gui=NONE')
+
+ feed('30iø<esc>o<esc>30ia<esc>')
+ screen:expect([[
+ øøøøøøøøøøøøøøøøøøøø|
+ {1:>>>}øøøøøøøøøø |
+ {2:aaaaaaaaaaaaaaaaaaaa}|
+ {1:>>>}{2:aaaaaaaaa^a }|
+ |
+ ]])
+ feed('k')
+ screen:expect([[
+ {2:øøøøøøøøøøøøøøøøøøøø}|
+ {1:>>>}{2:øøøøøøøøø^ø }|
+ aaaaaaaaaaaaaaaaaaaa|
+ {1:>>>}aaaaaaaaaa |
+ |
+ ]])
+ feed_command('highlight NonText guibg=NONE')
+ screen:expect([[
+ {2:øøøøøøøøøøøøøøøøøøøø}|
+ {3:>>>}{2:øøøøøøøøø^ø }|
+ aaaaaaaaaaaaaaaaaaaa|
+ {4:>>>}aaaaaaaaaa |
+ |
+ ]])
+ feed_command('set nocursorline')
+ screen:expect([[
+ øøøøøøøøøøøøøøøøøøøø|
+ {4:>>>}øøøøøøøøø^ø |
+ aaaaaaaaaaaaaaaaaaaa|
+ {4:>>>}aaaaaaaaaa |
+ :set nocursorline |
+ ]])
+ end)
+
it('always updated. vim-patch:8.1.0849', function()
local screen = Screen.new(50,5)
screen:set_default_attr_ids({