diff options
author | Matthieu Coudron <mattator@gmail.com> | 2017-07-26 23:28:26 +0200 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2017-09-30 11:43:26 +0900 |
commit | ba7277cfb4e2556f246446d06b53f3427f28130f (patch) | |
tree | 4e5137c99a53d8a300b7f7805b5940535e18effe /src/nvim/api/ui.c | |
parent | c580ef68e873745ae02a577f11cbabb5e43271e4 (diff) | |
download | rneovim-ba7277cfb4e2556f246446d06b53f3427f28130f.tar.gz rneovim-ba7277cfb4e2556f246446d06b53f3427f28130f.tar.bz2 rneovim-ba7277cfb4e2556f246446d06b53f3427f28130f.zip |
Adds nvim_get_hl_by_name/by_id
...in order to retrieve highlights.
Added test/functional/api/highlight_spec.lua
HL_NORMAL is not really a good name, since it's more like an empty attribute than the normal's one.
If one pays attention, syn_cterm_attr2entry is never called with attr=0 because it's always special cased before.
I suggest in subsequent PRs we remove the ATTR_OFF and just insert an EMPTY ATTR/RESET_ATTR/UNINITIALIZED for id 0.
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r-- | src/nvim/api/ui.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index bbbd5ab2dc..afbee09c1c 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -242,39 +242,7 @@ static void push_call(UI *ui, char *name, Array args) static void remote_ui_highlight_set(UI *ui, HlAttrs attrs) { Array args = ARRAY_DICT_INIT; - Dictionary hl = ARRAY_DICT_INIT; - - if (attrs.bold) { - PUT(hl, "bold", BOOLEAN_OBJ(true)); - } - - if (attrs.underline) { - PUT(hl, "underline", BOOLEAN_OBJ(true)); - } - - if (attrs.undercurl) { - PUT(hl, "undercurl", BOOLEAN_OBJ(true)); - } - - if (attrs.italic) { - PUT(hl, "italic", BOOLEAN_OBJ(true)); - } - - if (attrs.reverse) { - PUT(hl, "reverse", BOOLEAN_OBJ(true)); - } - - if (attrs.foreground != -1) { - PUT(hl, "foreground", INTEGER_OBJ(attrs.foreground)); - } - - if (attrs.background != -1) { - PUT(hl, "background", INTEGER_OBJ(attrs.background)); - } - - if (attrs.special != -1) { - PUT(hl, "special", INTEGER_OBJ(attrs.special)); - } + Dictionary hl = hlattrs2dict(attrs); ADD(args, DICTIONARY_OBJ(hl)); push_call(ui, "highlight_set", args); |