mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
api: make nvim_buf_set_virtual_text use correct namespace counter
This commit is contained in:
parent
7697628345
commit
b4a04fd80c
@ -5396,9 +5396,8 @@ int bufhl_add_virt_text(buf_T *buf,
|
|||||||
linenr_T lnum,
|
linenr_T lnum,
|
||||||
VirtText virt_text)
|
VirtText virt_text)
|
||||||
{
|
{
|
||||||
static int next_src_id = 1;
|
|
||||||
if (src_id == 0) {
|
if (src_id == 0) {
|
||||||
src_id = next_src_id++;
|
src_id = (int)nvim_create_namespace((String)STRING_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
BufhlLine *lineinfo = bufhl_tree_ref(&buf->b_bufhl_info, lnum, true);
|
BufhlLine *lineinfo = bufhl_tree_ref(&buf->b_bufhl_info, lnum, true);
|
||||||
|
@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
|
|||||||
|
|
||||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||||
local command, neq = helpers.command, helpers.neq
|
local command, neq = helpers.command, helpers.neq
|
||||||
|
local meths = helpers.meths
|
||||||
local curbufmeths, eq = helpers.curbufmeths, helpers.eq
|
local curbufmeths, eq = helpers.curbufmeths, helpers.eq
|
||||||
|
|
||||||
describe('Buffer highlighting', function()
|
describe('Buffer highlighting', function()
|
||||||
@ -517,4 +518,13 @@ describe('Buffer highlighting', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('and virtual text use the same namespace counter', function()
|
||||||
|
local set_virtual_text = curbufmeths.set_virtual_text
|
||||||
|
eq(1, add_highlight(0, "String", 0 , 0, -1))
|
||||||
|
eq(2, set_virtual_text(0, 0, {{"= text", "Comment"}}, {}))
|
||||||
|
eq(3, meths.create_namespace("my-ns"))
|
||||||
|
eq(4, add_highlight(0, "String", 0 , 0, -1))
|
||||||
|
eq(5, set_virtual_text(0, 0, {{"= text", "Comment"}}, {}))
|
||||||
|
eq(6, meths.create_namespace("other-ns"))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user