aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-02-08 16:16:16 +0100
committerbfredl <bjorn.linse@gmail.com>2023-02-08 18:02:55 +0100
commit625e990976540a0e2d2bccb98deb57d0919d1e89 (patch)
treef411e64b684b5e4a4772c57ffaefe77cd63e7d8c
parent1ca4a8b1ddf5256ad53cf486d0b2125434168270 (diff)
downloadrneovim-625e990976540a0e2d2bccb98deb57d0919d1e89.tar.gz
rneovim-625e990976540a0e2d2bccb98deb57d0919d1e89.tar.bz2
rneovim-625e990976540a0e2d2bccb98deb57d0919d1e89.zip
refactor(ui): cleanup 'redrawdebug', introduce "flush" mode
-rw-r--r--runtime/doc/options.txt14
-rw-r--r--src/nvim/option_defs.h2
-rw-r--r--src/nvim/optionstr.c3
-rw-r--r--src/nvim/ui.c6
4 files changed, 18 insertions, 7 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 1f91b89322..17f1c822ff 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4765,7 +4765,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Flags to change the way redrawing works, for debugging purposes.
Most useful with 'writedelay' set to some reasonable value.
Supports the following flags:
- compositor Indicate what redraws come from the compositor
+ compositor Indicate each redraw event handled by the compositor
by briefly flashing the redrawn regions in colors
indicating the redraw type. These are the highlight
groups used (and their default colors):
@@ -4777,6 +4777,11 @@ A jump table for the options with a short description can be found at |Q_op|.
RedrawDebugRecompose guibg=Red redraw generated by the
compositor itself, due to a
grid being moved or deleted.
+ line introduce a delay after each line drawn on the screen.
+ When using the TUI or another single-grid UI, "compositor"
+ gives more information and should be preferred (every
+ line is processed as a separate event by the compositor)
+ flush introduce a delay after each "flush" event.
nothrottle Turn off throttling of the message grid. This is an
optimization that joins many small scrolls to one
larger scroll when drawing the message area (with
@@ -4786,7 +4791,7 @@ A jump table for the options with a short description can be found at |Q_op|.
useful when running nvim inside a debugger (and
the test suite).
nodelta Send all internally redrawn cells to the UI, even if
- they are unchanged from the already displayed state.
+ they are unchanged from the already displayed state.
*'redrawtime'* *'rdt'*
'redrawtime' 'rdt' number (default 2000)
@@ -7372,8 +7377,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'writedelay'* *'wd'*
'writedelay' 'wd' number (default 0)
global
- The number of milliseconds to wait for each character sent to the
- screen. When positive, characters are sent to the UI one by one.
- See 'redrawdebug' for more options. For debugging purposes.
+ Only takes effect toghether with 'redrawdebug'.
+ The number of milliseconds to wait after each line or each flush
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index d190fc5999..0e0cc4c983 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -630,6 +630,8 @@ EXTERN unsigned rdb_flags;
#define RDB_NOTHROTTLE 0x002
#define RDB_INVALID 0x004
#define RDB_NODELTA 0x008
+#define RDB_LINE 0x010
+#define RDB_FLUSH 0x020
EXTERN long p_rdt; // 'redrawtime'
EXTERN long p_re; // 'regexpengine'
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 901477d869..7efbeadb2f 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -125,7 +125,8 @@ static char *(p_spo_values[]) = { "camel", "noplainbuffer", NULL };
static char *(p_icm_values[]) = { "nosplit", "split", NULL };
static char *(p_jop_values[]) = { "stack", "view", NULL };
static char *(p_tpf_values[]) = { "BS", "HT", "FF", "ESC", "DEL", "C0", "C1", NULL };
-static char *(p_rdb_values[]) = { "compositor", "nothrottle", "invalid", "nodelta", NULL };
+static char *(p_rdb_values[]) = { "compositor", "nothrottle", "invalid", "nodelta", "line",
+ "flush", NULL };
static char *(p_sloc_values[]) = { "last", "statusline", "tabline", NULL };
/// All possible flags for 'shm'.
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 9f1cb87eb0..b22dc4a661 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -419,7 +419,7 @@ void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol,
(const sattr_T *)grid->attrs + off);
// 'writedelay': flush & delay each time.
- if (p_wd && !(rdb_flags & RDB_COMPOSITOR)) {
+ if (p_wd && (rdb_flags & RDB_LINE)) {
// If 'writedelay' is active, set the cursor to indicate what was drawn.
ui_call_grid_cursor_goto(grid->handle, row,
MIN(clearcol, (int)grid->cols - 1));
@@ -510,6 +510,10 @@ void ui_flush(void)
pending_has_mouse = has_mouse;
}
ui_call_flush();
+
+ if (p_wd && (rdb_flags & RDB_FLUSH)) {
+ os_microdelay((uint64_t)labs(p_wd) * 1000U, true);
+ }
}
/// Check if 'mouse' is active for the current mode