diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-02-05 10:18:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-05 10:18:47 +0100 |
commit | 806a7c976d78da2bf7a46499452b4a3e30fae798 (patch) | |
tree | a479ac073770dca0d965bdf1b8023b6e95daa119 /src/nvim/api/vim.c | |
parent | 741b4d62623111a281790f1602f1c8be4113218e (diff) | |
parent | 0bafa44f8b9c4ad2a1cf5233bc207cba522a5dfe (diff) | |
download | rneovim-806a7c976d78da2bf7a46499452b4a3e30fae798.tar.gz rneovim-806a7c976d78da2bf7a46499452b4a3e30fae798.tar.bz2 rneovim-806a7c976d78da2bf7a46499452b4a3e30fae798.zip |
Merge pull request #17275 from bfredl/keysethl
refactor(api): use a keyset for highlight dicts
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index e9182fde7f..ada041bab2 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -140,22 +140,16 @@ Dictionary nvim__get_hl_defs(Integer ns_id, Error *err) /// @param[out] err Error details, if any /// // TODO(bfredl): val should take update vs reset flag -void nvim_set_hl(Integer ns_id, String name, Dictionary val, Error *err) +void nvim_set_hl(Integer ns_id, String name, Dict(highlight) *val, Error *err) FUNC_API_SINCE(7) { int hl_id = syn_check_group(name.data, (int)name.size); int link_id = -1; - HlAttrNames *names = NULL; // Only used when setting global namespace - if (ns_id == 0) { - names = xmalloc(sizeof(*names)); - *names = HLATTRNAMES_INIT; - } - HlAttrs attrs = dict2hlattrs(val, true, &link_id, names, err); + HlAttrs attrs = dict2hlattrs(val, true, &link_id, err); if (!ERROR_SET(err)) { - ns_hl_def((NS)ns_id, hl_id, attrs, link_id, names); + ns_hl_def((NS)ns_id, hl_id, attrs, link_id, val); } - xfree(names); } /// Set active namespace for highlights. |