From dd9554a8205c18ab4194d21445bb1fe6c960229f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 25 Mar 2019 03:27:24 +0100 Subject: inccommand: Ignore :redraw during preview closes #9777 --- src/nvim/ex_docmd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index c452129719..4d958b201a 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7807,11 +7807,12 @@ static void ex_redir(exarg_T *eap) redir_off = FALSE; } -/* - * ":redraw": force redraw - */ +/// ":redraw": force redraw static void ex_redraw(exarg_T *eap) { + if (State & CMDPREVIEW) { + return; // Ignore :redraw during 'inccommand' preview. #9777 + } int r = RedrawingDisabled; int p = p_lz; @@ -7840,11 +7841,12 @@ static void ex_redraw(exarg_T *eap) ui_flush(); } -/* - * ":redrawstatus": force redraw of status line(s) - */ +/// ":redrawstatus": force redraw of status line(s) static void ex_redrawstatus(exarg_T *eap) { + if (State & CMDPREVIEW) { + return; // Ignore :redrawstatus during 'inccommand' preview. #9777 + } int r = RedrawingDisabled; int p = p_lz; -- cgit From 0b8fc2742b9b559c4607202f5e6a79166a2b60d0 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 25 Mar 2019 03:55:12 +0100 Subject: inccommand: Disable K_EVENT during preview calculation 'inccommand' invokes ex_substitute() to build its "preview". During the brief (~millisecond) time it takes to execute that function, the buffer is "dirty" (its contents are invalid). Events must not be handled during this time, else they would see a temporary state which is not the true, logical state of the buffer. ref #9777 --- src/nvim/ex_cmds.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index af92a9c846..150e13efd5 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -6392,6 +6392,7 @@ void ex_substitute(exarg_T *eap) } block_autocmds(); // Disable events during command preview. + input_disable_events(); char_u *save_eap = eap->arg; garray_T save_view; @@ -6434,6 +6435,7 @@ void ex_substitute(exarg_T *eap) restore_search_patterns(); win_size_restore(&save_view); ga_clear(&save_view); + input_enable_events(); unblock_autocmds(); } -- cgit