aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/highlight.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
commit9be89f131f87608f224f0ee06d199fcd09d32176 (patch)
tree11022dcfa9e08cb4ac5581b16734196128688d48 /src/nvim/highlight.c
parentff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff)
parent88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff)
downloadrneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/highlight.c')
-rw-r--r--src/nvim/highlight.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index 8729c74ce8..d39ffcd177 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -219,11 +219,10 @@ int ns_get_hl(NS *ns_hl, int hl_id, bool link, bool nodefault)
bool fallback = true;
int tmp = false;
HlAttrs attrs = HLATTRS_INIT;
- if (ret.type == kObjectTypeDictionary) {
+ if (ret.type == kObjectTypeDict) {
fallback = false;
Dict(highlight) dict = KEYDICT_INIT;
- if (api_dict_to_keydict(&dict, KeyDict_highlight_get_field,
- ret.data.dictionary, &err)) {
+ if (api_dict_to_keydict(&dict, KeyDict_highlight_get_field, ret.data.dict, &err)) {
attrs = dict2hlattrs(&dict, true, &it.link_id, &err);
fallback = GET_BOOL_OR_TRUE(&dict, highlight, fallback);
tmp = dict.fallback; // or false
@@ -370,12 +369,15 @@ void update_window_hl(win_T *wp, bool invalid)
// determine window specific background set in 'winhighlight'
bool float_win = wp->w_floating && !wp->w_config.external;
- if (float_win && hl_def[HLF_NFLOAT] != 0) {
+ if (float_win && hl_def[HLF_NFLOAT] != 0 && ns_id > 0) {
wp->w_hl_attr_normal = hl_def[HLF_NFLOAT];
} else if (hl_def[HLF_COUNT] > 0) {
wp->w_hl_attr_normal = hl_def[HLF_COUNT];
+ } else if (float_win) {
+ wp->w_hl_attr_normal = HL_ATTR(HLF_NFLOAT) > 0
+ ? HL_ATTR(HLF_NFLOAT) : highlight_attr[HLF_NFLOAT];
} else {
- wp->w_hl_attr_normal = float_win ? HL_ATTR(HLF_NFLOAT) : 0;
+ wp->w_hl_attr_normal = 0;
}
if (wp->w_floating) {
@@ -872,9 +874,9 @@ HlAttrs syn_attr2entry(int attr)
}
/// Gets highlight description for id `attr_id` as a map.
-Dictionary hl_get_attr_by_id(Integer attr_id, Boolean rgb, Arena *arena, Error *err)
+Dict hl_get_attr_by_id(Integer attr_id, Boolean rgb, Arena *arena, Error *err)
{
- Dictionary dic = ARRAY_DICT_INIT;
+ Dict dic = ARRAY_DICT_INIT;
if (attr_id == 0) {
return dic;
@@ -885,19 +887,19 @@ Dictionary hl_get_attr_by_id(Integer attr_id, Boolean rgb, Arena *arena, Error *
"Invalid attribute id: %" PRId64, attr_id);
return dic;
}
- Dictionary retval = arena_dict(arena, HLATTRS_DICT_SIZE);
+ Dict retval = arena_dict(arena, HLATTRS_DICT_SIZE);
hlattrs2dict(&retval, NULL, syn_attr2entry((int)attr_id), rgb, false);
return retval;
}
-/// Converts an HlAttrs into Dictionary
+/// Converts an HlAttrs into Dict
///
-/// @param[in/out] hl Dictionary with pre-allocated space for HLATTRS_DICT_SIZE elements
+/// @param[in/out] hl Dict with pre-allocated space for HLATTRS_DICT_SIZE elements
/// @param[in] aep data to convert
/// @param use_rgb use 'gui*' settings if true, else resorts to 'cterm*'
/// @param short_keys change (foreground, background, special) to (fg, bg, sp) for 'gui*' settings
/// (foreground, background) to (ctermfg, ctermbg) for 'cterm*' settings
-void hlattrs2dict(Dictionary *hl, Dictionary *hl_attrs, HlAttrs ae, bool use_rgb, bool short_keys)
+void hlattrs2dict(Dict *hl, Dict *hl_attrs, HlAttrs ae, bool use_rgb, bool short_keys)
{
hl_attrs = hl_attrs ? hl_attrs : hl;
assert(hl->capacity >= HLATTRS_DICT_SIZE); // at most 16 items
@@ -1085,10 +1087,10 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
}
// Handle cterm attrs
- if (dict->cterm.type == kObjectTypeDictionary) {
+ if (dict->cterm.type == kObjectTypeDict) {
Dict(highlight_cterm) cterm[1] = KEYDICT_INIT;
if (!api_dict_to_keydict(cterm, KeyDict_highlight_cterm_get_field,
- dict->cterm.data.dictionary, err)) {
+ dict->cterm.data.dict, err)) {
return hlattrs;
}
@@ -1203,7 +1205,7 @@ static size_t hl_inspect_size(int attr)
static void hl_inspect_impl(Array *arr, int attr, Arena *arena)
{
- Dictionary item = ARRAY_DICT_INIT;
+ Dict item = ARRAY_DICT_INIT;
if (attr <= 0 || attr >= (int)set_size(&attr_entries)) {
return;
}
@@ -1242,5 +1244,5 @@ static void hl_inspect_impl(Array *arr, int attr, Arena *arena)
return;
}
PUT_C(item, "id", INTEGER_OBJ(attr));
- ADD_C(*arr, DICTIONARY_OBJ(item));
+ ADD_C(*arr, DICT_OBJ(item));
}