diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-08-14 12:33:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 12:33:12 +0200 |
commit | f767cee10002afc360af1aad209676d08cc3a758 (patch) | |
tree | f47652d37d72abf921de07ce1bd4ca35f85ca4ce /src/nvim/api/ui.c | |
parent | bec5e4cb6183f3b403aca35ef55c3798a48dc64b (diff) | |
parent | fa4c2601000df2d792b0de865da3ac8c43ab723f (diff) | |
download | rneovim-f767cee10002afc360af1aad209676d08cc3a758.tar.gz rneovim-f767cee10002afc360af1aad209676d08cc3a758.tar.bz2 rneovim-f767cee10002afc360af1aad209676d08cc3a758.zip |
Merge pull request #8790 from bfredl/hlattr
pass highlight attrs per value and thread-safely to TUI thread
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r-- | src/nvim/api/ui.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index d0db43c588..37d34c5843 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -351,12 +351,8 @@ static void remote_ui_hl_attr_define(UI *ui, Integer id, HlAttrs rgb_attrs, Array args = ARRAY_DICT_INIT; ADD(args, INTEGER_OBJ(id)); - - Dictionary rgb_hl = hlattrs2dict(&rgb_attrs, true); - ADD(args, DICTIONARY_OBJ(rgb_hl)); - - Dictionary cterm_hl = hlattrs2dict(&cterm_attrs, false); - ADD(args, DICTIONARY_OBJ(cterm_hl)); + ADD(args, DICTIONARY_OBJ(hlattrs2dict(rgb_attrs, true))); + ADD(args, DICTIONARY_OBJ(hlattrs2dict(cterm_attrs, false))); if (ui->ui_ext[kUIHlState]) { ADD(args, ARRAY_OBJ(copy_array(info))); @@ -372,21 +368,12 @@ static void remote_ui_highlight_set(UI *ui, int id) Array args = ARRAY_DICT_INIT; UIData *data = ui->data; - HlAttrs attrs = HLATTRS_INIT; if (data->hl_id == id) { return; } data->hl_id = id; - - if (id != 0) { - HlAttrs *aep = syn_attr2entry(id); - if (aep) { - attrs = *aep; - } - } - - Dictionary hl = hlattrs2dict(&attrs, ui->rgb); + Dictionary hl = hlattrs2dict(syn_attr2entry(id), ui->rgb); ADD(args, DICTIONARY_OBJ(hl)); push_call(ui, "highlight_set", args); @@ -524,8 +511,7 @@ static void remote_ui_cmdline_show(UI *ui, Array args) Array new_item = ARRAY_DICT_INIT; int attr = (int)item.items[0].data.integer; if (attr) { - HlAttrs *aep = syn_attr2entry(attr); - Dictionary rgb_attrs = hlattrs2dict(aep, ui->rgb ? kTrue : kFalse); + Dictionary rgb_attrs = hlattrs2dict(syn_attr2entry(attr), ui->rgb); ADD(new_item, DICTIONARY_OBJ(rgb_attrs)); } else { ADD(new_item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT)); |