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/ex_getln.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/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 6b52ce7c80..775d002e58 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -215,6 +215,8 @@ static int hislen = 0; /* actual length of history tables */ /// user interrupting highlight function to not interrupt command-line. static bool getln_interrupted_highlight = false; +static bool need_cursor_update = false; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ex_getln.c.generated.h" @@ -2944,30 +2946,22 @@ static void ui_ext_cmdline_show(CmdlineInfo *line) char *buf = xmallocz(len); memset(buf, '*', len); Array item = ARRAY_DICT_INIT; - ADD(item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT)); + ADD(item, INTEGER_OBJ(0)); ADD(item, STRING_OBJ(((String) { .data = buf, .size = len }))); ADD(content, ARRAY_OBJ(item)); } else if (kv_size(line->last_colors.colors)) { for (size_t i = 0; i < kv_size(line->last_colors.colors); i++) { CmdlineColorChunk chunk = kv_A(line->last_colors.colors, i); Array item = ARRAY_DICT_INIT; + ADD(item, INTEGER_OBJ(chunk.attr)); - if (chunk.attr) { - HlAttrs *aep = syn_attr2entry(chunk.attr); - // TODO(bfredl): this desicion could be delayed by making attr_code a - // recognized type - Dictionary rgb_attrs = hlattrs2dict(aep, true); - ADD(item, DICTIONARY_OBJ(rgb_attrs)); - } else { - ADD(item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT)); - } ADD(item, STRING_OBJ(cbuf_to_string((char *)line->cmdbuff + chunk.start, chunk.end-chunk.start))); ADD(content, ARRAY_OBJ(item)); } } else { Array item = ARRAY_DICT_INIT; - ADD(item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT)); + ADD(item, INTEGER_OBJ(0)); ADD(item, STRING_OBJ(cstr_to_string((char *)(line->cmdbuff)))); ADD(content, ARRAY_OBJ(item)); } @@ -3033,6 +3027,8 @@ void cmdline_screen_cleared(void) } prev_ccline = prev_ccline->prev_ccline; } + + need_cursor_update = true; } /// called by ui_flush, do what redraws neccessary to keep cmdline updated. @@ -3501,6 +3497,10 @@ static void cursorcmd(void) if (ccline.redraw_state < kCmdRedrawPos) { ccline.redraw_state = kCmdRedrawPos; } + if (need_cursor_update) { + need_cursor_update = false; + setcursor(); + } return; } |