diff options
-rw-r--r-- | src/nvim/terminal.c | 1 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 85 | ||||
-rw-r--r-- | test/functional/ui/searchhl_spec.lua | 11 |
3 files changed, 75 insertions, 22 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 5a05847197..d006477c80 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1106,6 +1106,7 @@ static void refresh_timer_cb(TimeWatcher *watcher, void *data) { refresh_pending = false; if (exiting // Cannot redraw (requires event loop) during teardown/exit. + || (State & CMDPREVIEW) // WM_LIST (^D) is not redrawn, unlike the normal wildmenu. So we must // skip redraws to keep it visible. || wild_menu_showing == WM_LIST) { diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 7dfe59b8b0..ee1a3240a2 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -16,6 +16,8 @@ local retry = helpers.retry local source = helpers.source local wait = helpers.wait local nvim = helpers.nvim +local iswin = helpers.iswin +local sleep = helpers.sleep local default_text = [[ Inc substitution on @@ -1850,7 +1852,7 @@ describe(":substitute", function() clear() end) - it(", inccommand=split, highlights multiline substitutions", function() + it("inccommand=split, highlights multiline substitutions", function() common_setup(screen, "split", multiline_text) feed("gg") @@ -1912,7 +1914,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=nosplit, highlights multiline substitutions", function() + it("inccommand=nosplit, highlights multiline substitutions", function() common_setup(screen, "nosplit", multiline_text) feed("gg") @@ -1955,7 +1957,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, highlights multiple matches on a line", function() + it("inccommand=split, highlights multiple matches on a line", function() common_setup(screen, "split", multimatch_text) command("set gdefault") feed("gg") @@ -1980,7 +1982,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=nosplit, highlights multiple matches on a line", function() + it("inccommand=nosplit, highlights multiple matches on a line", function() common_setup(screen, "nosplit", multimatch_text) command("set gdefault") feed("gg") @@ -2005,7 +2007,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, with \\zs", function() + it("inccommand=split, with \\zs", function() common_setup(screen, "split", multiline_text) feed("gg") @@ -2029,7 +2031,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=nosplit, with \\zs", function() + it("inccommand=nosplit, with \\zs", function() common_setup(screen, "nosplit", multiline_text) feed("gg") @@ -2053,7 +2055,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, substitutions of different length", + it("inccommand=split, substitutions of different length", function() common_setup(screen, "split", "T T123 T2T TTT T090804\nx") @@ -2077,7 +2079,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=nosplit, substitutions of different length", function() + it("inccommand=nosplit, substitutions of different length", function() common_setup(screen, "nosplit", "T T123 T2T TTT T090804\nx") feed(":%s/T\\([0-9]\\+\\)/\\1\\1/g") @@ -2100,7 +2102,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, contraction of lines", function() + it("inccommand=split, contraction of lines", function() local text = [[ T T123 T T123 T2T TT T23423424 x @@ -2149,7 +2151,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=nosplit, contraction of lines", function() + it("inccommand=nosplit, contraction of lines", function() local text = [[ T T123 T T123 T2T TT T23423424 x @@ -2179,7 +2181,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, multibyte text", function() + it("inccommand=split, multibyte text", function() common_setup(screen, "split", multibyte_text) feed(":%s/£.*ѫ/X¥¥") screen:expect([[ @@ -2220,7 +2222,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=nosplit, multibyte text", function() + it("inccommand=nosplit, multibyte text", function() common_setup(screen, "nosplit", multibyte_text) feed(":%s/£.*ѫ/X¥¥") screen:expect([[ @@ -2261,7 +2263,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, small cmdwinheight", function() + it("inccommand=split, small cmdwinheight", function() common_setup(screen, "split", long_multiline_text) command("set cmdwinheight=2") @@ -2323,7 +2325,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, large cmdwinheight", function() + it("inccommand=split, large cmdwinheight", function() common_setup(screen, "split", long_multiline_text) command("set cmdwinheight=11") @@ -2385,7 +2387,7 @@ describe(":substitute", function() ]]) end) - it(", inccommand=split, lookaround", function() + it("inccommand=split, lookaround", function() common_setup(screen, "split", "something\neverything\nsomeone") feed([[:%s/\(some\)\@<lt>=thing/one/]]) screen:expect([[ @@ -2469,4 +2471,57 @@ describe(":substitute", function() :%s/some\(thing\)\@!/every/^ | ]]) end) + + it('with inccommand during :terminal activity', function() + command("set cmdwinheight=3") + if iswin() then + feed([[:terminal for /L \%I in (1,1,5000) do @(echo xxx & echo xxx & echo xxx)<cr>]]) + else + feed([[:terminal for i in $(seq 1 5000); do printf 'xxx\nxxx\nxxx\n'; done<cr>]]) + end + command('file term') + command('new') + common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz') + command('wincmd =') + + -- Allow some terminal output. + screen:expect([[ + bar baz fox | + bar foo ba^z | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + xxx | + xxx | + xxx | + xxx | + xxx | + xxx | + {10:term }| + | + ]]) + + feed('gg') + feed(':%s/foo/ZZZ') + sleep(50) -- Allow some terminal activity. + screen:expect([[ + {12:ZZZ} bar baz | + bar baz fox | + bar {12:ZZZ} baz | + {15:~ }| + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + xxx | + xxx | + {10:term }| + |1| {12:ZZZ} bar baz | + |3| bar {12:ZZZ} baz | + {15:~ }| + {10:[Preview] }| + :%s/foo/ZZZ^ | + ]]) + end) end) diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index f241a9fc44..168080a092 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -5,6 +5,7 @@ local feed_command = helpers.feed_command local eq = helpers.eq local eval = helpers.eval local iswin = helpers.iswin +local sleep = helpers.sleep describe('search highlighting', function() local screen @@ -92,18 +93,13 @@ describe('search highlighting', function() ]]) end) - it('#x is preserved during :terminal activity', function() - -- Because this test verifies a _lack_ of activity after screen:sleep(), we - -- must wait the full timeout. So make it reasonable. - screen.timeout = 1000 - + it('is preserved during :terminal activity', function() if iswin() then feed([[:terminal for /L \%I in (1,1,5000) do @(echo xxx & echo xxx & echo xxx)<cr>]]) else - feed([[:terminal for i in $(seq 1 5000); do printf 'xxx\nxxx\nxxx\n'; sleep 0.1; done<cr>]]) + feed([[:terminal for i in $(seq 1 5000); do printf 'xxx\nxxx\nxxx\n'; done<cr>]]) end - feed([[<C-\><C-N>gg]]) feed(':file term<CR>') feed(':vnew<CR>') insert([[ @@ -112,6 +108,7 @@ describe('search highlighting', function() bar foo baz ]]) feed('/foo') + sleep(50) -- Allow some terminal activity. screen:expect([[ {3:foo} bar baz {3:│}xxx | bar baz {2:foo} {3:│}xxx | |