diff options
Diffstat (limited to 'src/nvim/highlight.c')
-rw-r--r-- | src/nvim/highlight.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index 5efbafa128..0b39ba442e 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -38,7 +38,7 @@ void highlight_init(void) bool highlight_use_hlstate(void) { if (hlstate_active) { - return false; + return false; } hlstate_active = true; // hl tables must now be rebuilt. @@ -89,9 +89,26 @@ static int get_attr_entry(HlEntry entry) map_put(HlEntry, int)(attr_entry_ids, entry, id); + Array inspect = hl_inspect(id); + + // Note: internally we don't distinguish between cterm and rgb attributes, + // remote_ui_hl_attr_define will however. + ui_call_hl_attr_define(id, entry.attr, entry.attr, inspect); + api_free_array(inspect); return id; } +/// When a UI connects, we need to send it the table of higlights used so far. +void ui_send_all_hls(UI *ui) +{ + for (size_t i = 1; i < kv_size(attr_entries); i++) { + Array inspect = hl_inspect((int)i); + ui->hl_attr_define(ui, (Integer)i, kv_A(attr_entries, i).attr, + kv_A(attr_entries, i).attr, inspect); + api_free_array(inspect); + } +} + /// Get attribute code for a syntax group. int hl_get_syn_attr(int idx, HlAttrs at_en) { |