aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-04-14 11:25:24 +0200
committerGitHub <noreply@github.com>2019-04-14 11:25:24 +0200
commit9ddf99172cc9e8ea3ac47516083751fca75c3501 (patch)
tree297dc3a02495e787b7e8c95190aea0be4ef381cb
parent2c34a10aa25b38a8cf3b0c21a668b184883b4cff (diff)
parent0b8fc2742b9b559c4607202f5e6a79166a2b60d0 (diff)
downloadrneovim-9ddf99172cc9e8ea3ac47516083751fca75c3501.tar.gz
rneovim-9ddf99172cc9e8ea3ac47516083751fca75c3501.tar.bz2
rneovim-9ddf99172cc9e8ea3ac47516083751fca75c3501.zip
Merge pull request #9783 from justinmk/inccommand-ignore-redraw
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/ex_docmd.c14
-rw-r--r--test/functional/ui/inccommand_spec.lua27
3 files changed, 37 insertions, 6 deletions
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();
}
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;
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index c215ece2f2..4f243e6413 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -2607,3 +2607,30 @@ it(':substitute with inccommand during :terminal activity', function()
end)
end)
+
+it(':substitute with inccommand, timer-induced :redraw #9777', function()
+ local screen = Screen.new(30,12)
+ clear()
+ command('set cmdwinheight=3')
+ command('call timer_start(10, {-> execute("redraw")}, {"repeat":-1})')
+ command('call timer_start(10, {-> execute("redrawstatus")}, {"repeat":-1})')
+ common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz')
+
+ feed('gg')
+ feed(':%s/foo/ZZZ')
+ sleep(20) -- Allow some timer activity.
+ screen:expect([[
+ {12:ZZZ} bar baz |
+ bar baz fox |
+ bar {12:ZZZ} baz |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {11:[No Name] [+] }|
+ |1| {12:ZZZ} bar baz |
+ |3| bar {12:ZZZ} baz |
+ {15:~ }|
+ {10:[Preview] }|
+ :%s/foo/ZZZ^ |
+ ]])
+end)