diff options
| author | Björn Linse <bjorn.linse@gmail.com> | 2018-07-26 21:27:41 +0200 |
|---|---|---|
| committer | Björn Linse <bjorn.linse@gmail.com> | 2018-08-13 13:35:35 +0200 |
| commit | fa4c2601000df2d792b0de865da3ac8c43ab723f (patch) | |
| tree | 9048f5e4bf1a7aa06c24eade3f7b8f27fd9cacca /src/nvim/tui | |
| parent | fab555e59c627b07e8a2d229d95737be7d6ce666 (diff) | |
| download | rneovim-fa4c2601000df2d792b0de865da3ac8c43ab723f.tar.gz rneovim-fa4c2601000df2d792b0de865da3ac8c43ab723f.tar.bz2 rneovim-fa4c2601000df2d792b0de865da3ac8c43ab723f.zip | |
cursor_shape: use attribute ids instead of syntax ids
As attribute ids is the convention in the UI protocol
Also remove non-threadsafe calls in tui.c to syntax module.
Diffstat (limited to 'src/nvim/tui')
| -rw-r--r-- | src/nvim/tui/tui.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index c010f2e1a2..df14ddf988 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -874,7 +874,7 @@ static cursorentry_T decode_cursor_entry(Dictionary args) r.blinkon = (int)value.data.integer; } else if (strequal(key, "blinkoff")) { r.blinkoff = (int)value.data.integer; - } else if (strequal(key, "hl_id")) { + } else if (strequal(key, "attr_id")) { r.id = (int)value.data.integer; } } @@ -942,14 +942,10 @@ static void tui_set_mode(UI *ui, ModeShape mode) TUIData *data = ui->data; cursorentry_T c = data->cursor_shapes[mode]; - if (c.id != 0 && ui->rgb) { - // TODO(bfredl): NOT threadsafe, include attr in cursor_shape already. - int attr = syn_id2attr(c.id); - if (attr > 0 && attr < (int)kv_size(data->attrs)) { - int color = kv_A(data->attrs, attr).rgb_bg_color; - UNIBI_SET_NUM_VAR(data->params[0], color); - unibi_out_ext(ui, data->unibi_ext.set_cursor_color); - } + if (c.id != 0 && c.id < (int)kv_size(data->attrs) && ui->rgb) { + int color = kv_A(data->attrs, c.id).rgb_bg_color; + UNIBI_SET_NUM_VAR(data->params[0], color); + unibi_out_ext(ui, data->unibi_ext.set_cursor_color); } int shape; |