From 28e26e05bc4cd2bd8e1abc2dd4d720fd9199456d Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 8 Feb 2023 16:24:33 +0100 Subject: perf(ui): mitigate redraw latency regression from TUI refactor While the new RPC encoder/decoder implementation in general should have less overhead than the deleted UIBridge serializer previously used for the TUI, it regresses on redraw latency in one important aspect. The old bridge implementation allowed the TUI to process a previous screen line internally in parallel with the main thread rendering the next one in win_line etc. As printing the escape sequences in highlighted cells has a considerable hit in profiles, this has a substantial effect on redraw latency. The RPC implementation, however, waits with sending any data until either a flush, or the buffer is full. This change lowers the granularity of communication again, using an adjustable threshold counted in number of cell events (discounting long repeats and clearing as maximum a single extra event). The current value is guesstimated to something simple on a reasonable scale, which should be bigger than a single line, but multiple events for a big multi-window screen. --- src/nvim/ui.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index 9140a9f1f3..e83f93eb07 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -79,6 +79,8 @@ typedef struct { uint32_t ncalls; ///< number of calls made to the current event (plus one for the name!) bool flushed_events; ///< events where sent to client without "flush" event + size_t ncells_pending; ///< total number of cells since last buffer flush + int hl_id; // Current highlight for legacy put event. Integer cursor_row, cursor_col; // Intended visible cursor position. -- cgit From 7f424e2b65779c59fc0cac3cc7508ba2ec07f200 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 23 Feb 2023 18:29:36 +0100 Subject: feat(api): more fields in nvim_list_uis Problem: nvim_list_uis does not report all ":help ui-option" fields. Solution: Store ":help ui-option" fields on the `UI` object and update ui_array. --- src/nvim/ui.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index e83f93eb07..c1377f56b4 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -103,6 +103,14 @@ struct ui_t { double pum_height; double pum_width; + // TUI fields. + char *term_name; + char *term_background; + int term_colors; + int stdin_fd; + bool stdin_tty; + bool stdout_tty; + // TODO(bfredl): integrate into struct! UIData data[1]; }; -- cgit From ce597235a26839826de88ecd8b949ec54c310fbd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 27 Feb 2023 16:31:05 +0100 Subject: feat(ui): restore has('gui_running') Problem: has('gui_running') is still common in the wild and our answer has changed over time, causing frustration. https://github.com/vimpostor/vim-tpipeline/commit/95a6ccbe9f33bc42dd4cee45731d8bc3fbcd92d1 Solution: Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI. --- src/nvim/ui.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index c1377f56b4..dc0ccc73ea 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -107,7 +107,6 @@ struct ui_t { char *term_name; char *term_background; int term_colors; - int stdin_fd; bool stdin_tty; bool stdout_tty; -- cgit From 5f03a1eaabfc8de2b3a9c666fcd604763f41e152 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 20 Oct 2023 15:10:33 +0200 Subject: build(lint): remove unnecessary clint.py rules Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. --- src/nvim/ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index dc0ccc73ea..807bc6241c 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -30,7 +30,7 @@ typedef enum { kUIExtCount, } UIExtension; -EXTERN const char *ui_ext_names[] INIT(= { +EXTERN const char *ui_ext_names[] INIT( = { "ext_cmdline", "ext_popupmenu", "ext_tabline", -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/ui.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index 807bc6241c..d399802c99 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -1,5 +1,4 @@ -#ifndef NVIM_UI_H -#define NVIM_UI_H +#pragma once #include #include @@ -127,4 +126,3 @@ typedef struct ui_event_callback { // uncrustify:on EXTERN MultiQueue *resize_events; -#endif // NVIM_UI_H -- cgit From 8d9789a0f3b748b75ac4ae1b8e43d27af40d49fe Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 7 Nov 2023 11:31:21 -0600 Subject: docs: deprecate the "term_background" UI field --- src/nvim/ui.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index d399802c99..3feb0bf603 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -104,7 +104,8 @@ struct ui_t { // TUI fields. char *term_name; - char *term_background; + char *term_background; ///< Deprecated. No longer needed since background color detection happens + ///< in Lua. To be removed in a future release. int term_colors; bool stdin_tty; bool stdout_tty; -- cgit From e38a05369293293b5b510b1b0014fcc2e7cb87f4 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:46:03 +0100 Subject: build(IWYU): export generated headers --- src/nvim/ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index 3feb0bf603..e54c3f2435 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -122,7 +122,7 @@ typedef struct ui_event_callback { // uncrustify:off #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui.h.generated.h" -# include "ui_events_call.h.generated.h" +# include "ui_events_call.h.generated.h" // IWYU pragma: export #endif // uncrustify:on -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index e54c3f2435..0dc53e4ecc 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -10,7 +10,7 @@ #include "nvim/highlight_defs.h" #include "nvim/macros.h" #include "nvim/memory.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" struct ui_t; -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui.h') diff --git a/src/nvim/ui.h b/src/nvim/ui.h index 0dc53e4ecc..666a869c89 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -8,7 +8,7 @@ #include "nvim/event/multiqueue.h" #include "nvim/globals.h" #include "nvim/highlight_defs.h" -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/memory.h" #include "nvim/types_defs.h" -- cgit