diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-20 07:34:50 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-09-23 14:42:57 +0200 |
commit | 737f58e23230ea14f1648ac1fc7f442ea0f8563c (patch) | |
tree | d16bee4c0ad2bb5ff2ec058cd09133a285674fef /src/nvim/highlight.c | |
parent | 5acdc4499e2036c90172b2b085f207ee4d5cfee4 (diff) | |
download | rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.tar.gz rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.tar.bz2 rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.zip |
refactor(api)!: rename Dictionary => Dict
In the api_info() output:
:new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val')
...
{'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1}
The `ArrayOf(Integer, 2)` return type didn't break clients when we added
it, which is evidence that clients don't use the `return_type` field,
thus renaming Dictionary => Dict in api_info() is not (in practice)
a breaking change.
Diffstat (limited to 'src/nvim/highlight.c')
-rw-r--r-- | src/nvim/highlight.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index b802eab4b9..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 @@ -875,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; @@ -888,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 @@ -1088,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; } @@ -1206,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; } @@ -1245,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)); } |