mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
231e1988ed
commit
d05d63a18f
@ -1530,6 +1530,10 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena)
|
|||||||
if (link == -1) {
|
if (link == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (ns_id == 0 && sgp->sg_cleared && sgp->sg_set == 0) {
|
||||||
|
// table entry was created but not ever set
|
||||||
|
return false;
|
||||||
|
}
|
||||||
HlAttrs attr =
|
HlAttrs attr =
|
||||||
syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set));
|
syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set));
|
||||||
*hl = arena_dict(arena, HLATTRS_DICT_SIZE + 1);
|
*hl = arena_dict(arena, HLATTRS_DICT_SIZE + 1);
|
||||||
|
@ -575,4 +575,25 @@ describe('API: get highlight', function()
|
|||||||
meths.set_hl(0, 'Foo', hl)
|
meths.set_hl(0, 'Foo', hl)
|
||||||
eq(hl, meths.get_hl(0, { name = 'Foo', link = true }))
|
eq(hl, meths.get_hl(0, { name = 'Foo', link = true }))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("doesn't contain unset groups", function()
|
||||||
|
local id = meths.get_hl_id_by_name "@foobar.hubbabubba"
|
||||||
|
ok(id > 0)
|
||||||
|
|
||||||
|
local data = meths.get_hl(0, {})
|
||||||
|
eq(nil, data["@foobar.hubbabubba"])
|
||||||
|
eq(nil, data["@foobar"])
|
||||||
|
|
||||||
|
command 'hi @foobar.hubbabubba gui=bold'
|
||||||
|
data = meths.get_hl(0, {})
|
||||||
|
eq({bold = true}, data["@foobar.hubbabubba"])
|
||||||
|
eq(nil, data["@foobar"])
|
||||||
|
|
||||||
|
-- @foobar.hubbabubba was explicitly cleared and thus shows up
|
||||||
|
-- but @foobar was never touched, and thus doesn't
|
||||||
|
command 'hi clear @foobar.hubbabubba'
|
||||||
|
data = meths.get_hl(0, {})
|
||||||
|
eq({}, data["@foobar.hubbabubba"])
|
||||||
|
eq(nil, data["@foobar"])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user