mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
perf(ui): reduce allocation overhead when encoding "redraw" events
Note for external UIs: Nvim can now emit multiple "redraw" event batches before a final "flush" event is received. To retain existing behavior, clients should make sure to update visible state at an explicit "flush" event, not just the end of a "redraw" batch of event. * Get rid of copy_object() blizzard in the auto-generated ui_event layer * Special case "grid_line" by encoding screen state directly to msgpack events with no intermediate API events. * Get rid of the arcane notion of referring to the screen as the "shell" * Array and Dictionary are kvec_t:s, so define them as such. * Allow kvec_t:s, such as Arrays and Dictionaries, to be allocated with a predetermined size within an arena. * Eliminate redundant capacity checking when filling such kvec_t:s with values.
This commit is contained in:
@@ -2755,13 +2755,13 @@ static void display_showcmd(void)
|
||||
showcmd_is_clear = (len == 0);
|
||||
|
||||
if (ui_has(kUIMessages)) {
|
||||
Array content = ARRAY_DICT_INIT;
|
||||
MAXSIZE_TEMP_ARRAY(content, 1);
|
||||
MAXSIZE_TEMP_ARRAY(chunk, 2);
|
||||
if (len > 0) {
|
||||
Array chunk = ARRAY_DICT_INIT;
|
||||
// placeholder for future highlight support
|
||||
ADD(chunk, INTEGER_OBJ(0));
|
||||
ADD(chunk, STRING_OBJ(cstr_to_string((char *)showcmd_buf)));
|
||||
ADD(content, ARRAY_OBJ(chunk));
|
||||
ADD_C(chunk, INTEGER_OBJ(0));
|
||||
ADD_C(chunk, STRING_OBJ(cstr_as_string((char *)showcmd_buf)));
|
||||
ADD_C(content, ARRAY_OBJ(chunk));
|
||||
}
|
||||
ui_call_msg_showcmd(content);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user