diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-07-06 14:39:50 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2018-07-21 13:21:58 +0200 |
commit | 1adb01c120d04bdbf25cd4ea6151ecd5f2de3a72 (patch) | |
tree | 1f906f5f77b77bc0beecb33320ceb4c15ff5c58e /src/nvim/highlight.c | |
parent | 2134396074d86c344aaf43c3b839fd38c499fb69 (diff) | |
download | rneovim-1adb01c120d04bdbf25cd4ea6151ecd5f2de3a72.tar.gz rneovim-1adb01c120d04bdbf25cd4ea6151ecd5f2de3a72.tar.bz2 rneovim-1adb01c120d04bdbf25cd4ea6151ecd5f2de3a72.zip |
ui: use line-based rather than char-based updates in screen.c
Add ext_newgrid and ext_hlstate extensions. These use predefined
highlights and line-segment based updates, for efficiency and
simplicity.. The ext_hlstate extension in addition allows semantic
identification of builtin and syntax highlights.
Reimplement the old char-based updates in the remote UI layer, for
compatibility. For the moment, this is still the default. The bulitin
TUI uses the new line-based protocol.
cmdline uses curwin cursor position when ext_cmdline is active.
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) { |