aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNull Chilly <56817415+nullchilly@users.noreply.github.com>2023-05-22 15:49:01 +0700
committerGitHub <noreply@github.com>2023-05-22 09:49:01 +0100
commitb7708eac24c22a96676176c68569d6859a9f793f (patch)
tree322256ff60199e571856fd037c1c1ec4eac15659
parent4f1d75daf8f4873d995c7e1eb93e56a2b22d2046 (diff)
downloadrneovim-b7708eac24c22a96676176c68569d6859a9f793f.tar.gz
rneovim-b7708eac24c22a96676176c68569d6859a9f793f.tar.bz2
rneovim-b7708eac24c22a96676176c68569d6859a9f793f.zip
fix(api): nvim_get_hl should return default flag
-rw-r--r--src/nvim/highlight_group.c3
-rw-r--r--test/functional/api/highlight_spec.lua5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index 41e7bdb7ac..6965c53f59 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -1548,6 +1548,9 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena)
HlAttrs attr =
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);
+ if (attr.rgb_ae_attr & HL_DEFAULT) {
+ PUT_C(*hl, "default", BOOLEAN_OBJ(true));
+ }
if (link > 0) {
PUT_C(*hl, "link", STRING_OBJ(cstr_as_string(hl_table[link - 1].sg_name)));
}
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 1601184e1b..d3a79327ae 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -596,4 +596,9 @@ describe('API: get highlight', function()
eq({}, data["@foobar.hubbabubba"])
eq(nil, data["@foobar"])
end)
+
+ it('should return default flag', function()
+ meths.set_hl(0, 'Tried', { fg = "#00ff00", default = true })
+ eq({ fg = tonumber('00ff00', 16), default = true }, meths.get_hl(0, { name = 'Tried' }))
+ end)
end)