aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/bufhl_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-01-21 15:26:55 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2020-09-03 15:40:24 +0200
commit49f5b57587ececf37415c64de6224e09baa80f48 (patch)
tree6b6f6b714729557549a3947953e3c2a789906817 /test/functional/ui/bufhl_spec.lua
parentd3302573ba5f117fe7e1316be27321c3d9ffd261 (diff)
downloadrneovim-49f5b57587ececf37415c64de6224e09baa80f48.tar.gz
rneovim-49f5b57587ececf37415c64de6224e09baa80f48.tar.bz2
rneovim-49f5b57587ececf37415c64de6224e09baa80f48.zip
decor: sketch new decorations API
return decorations back lol no nvim_buf_get_virtual_text share decorations that are hl only to avoid alloc avalanche
Diffstat (limited to 'test/functional/ui/bufhl_spec.lua')
-rw-r--r--test/functional/ui/bufhl_spec.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 3cb592c714..0262a5b59b 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -690,7 +690,7 @@ describe('Buffer highlighting', function()
end)
it('can be retrieved', function()
- local get_virtual_text = curbufmeths.get_virtual_text
+ local get_extmarks = curbufmeths.get_extmarks
local line_count = curbufmeths.line_count
local s1 = {{'Köttbullar', 'Comment'}, {'Kräuterbutter'}}
@@ -699,12 +699,14 @@ 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(s1, get_virtual_text(0))
+ eq({{1, 0, 0, {virt_text = s1}}}, get_extmarks(id1, {0,0}, {0, -1}, {}, true))
- set_virtual_text(-1, line_count(), s2, {})
- eq(s2, get_virtual_text(line_count()))
+ -- 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}, {}, true))
- eq({}, get_virtual_text(line_count() + 9000))
+ eq({}, get_extmarks(id1, {lastline+9000,0}, {lastline+9000, -1}, {}, false))
end)
it('is not highlighted by visual selection', function()