From c6954437277175c9e2b8eb7e7e753314725aef8b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 3 Aug 2017 00:41:52 +0200 Subject: win_redr_status(): skip if wildmenu is showing This might be too coarse, but it passes all tests ... A more nuanced approach might be: only skip the windows whose statuslines are overwritten by the wildmenu. Closes #2255 Closes #7108 vim-patch:8.0.0710 N/A because of the changes in this commit. --- test/functional/ui/wildmode_spec.lua | 150 ++++++++++++++++++++++++++--------- 1 file changed, 113 insertions(+), 37 deletions(-) (limited to 'test/functional/ui/wildmode_spec.lua') diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 052cdd55a1..154f508924 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -1,57 +1,133 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, command = helpers.clear, helpers.feed, helpers.command +local iswin, set_shell_powershell = helpers.iswin, helpers.set_shell_powershell +local nvim_dir = helpers.nvim_dir local funcs = helpers.funcs +local eq = helpers.eq +local eval = helpers.eval +local retry = helpers.retry -if helpers.pending_win32(pending) then return end - -describe("'wildmode'", function() +describe("'wildmenu'", function() local screen - before_each(function() clear() screen = Screen.new(25, 5) screen:attach() end) - after_each(function() screen:detach() end) - describe("'wildmenu'", function() - it(':sign shows wildmenu completions', function() - command('set wildmode=full') - command('set wildmenu') - feed(':sign ') - screen:expect([[ - | - ~ | - ~ | - define jump list > | - :sign define^ | - ]]) - end) + it(':sign shows wildmenu completions', function() + command('set wildmode=full') + command('set wildmenu') + feed(':sign ') + screen:expect([[ + | + ~ | + ~ | + define jump list > | + :sign define^ | + ]]) + end) + + it('does not crash after cycling back to original text', function() + command('set wildmode=full') + feed(':j') + screen:expect([[ + | + ~ | + ~ | + join jumps | + :j^ | + ]]) + -- This would cause nvim to crash before #6650 + feed('') + screen:expect([[ + | + ~ | + ~ | + ! # & < = > @ > | + :!^ | + ]]) + end) + + it('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('does not crash after cycling back to original text', function() - command('set wildmode=full') - feed(':j') - screen:expect([[ - | - ~ | - ~ | - join jumps | - :j^ | - ]]) - -- This would cause nvim to crash before #6650 - feed('') - screen:expect([[ - | - ~ | - ~ | - ! # & < = > @ > | - :!^ | - ]]) + command('set wildmenu wildmode=full') + command('set scrollback=4') + if iswin() then + if helpers.pending_win32(pending) then return end + -- feed([[:terminal 1,2,3,4,5 | foreach-object -process {echo $_; sleep 0.1}]]) + else + feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done]]) + end + screen:sleep(50) -- Allow some output. + feed([[gg]]) + feed([[:sign ]]) -- Invoke wildmenu. + screen:sleep(50) -- Allow some output. + screen:expect([[ + foo | + foo | + foo | + define jump list > | + :sign define^ | + ]]) + end) + + it('ignores :redrawstatus called from a timer #7108', 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 + + command('set wildmenu wildmode=full') + command([[call timer_start(10, {->execute('redrawstatus')}, {'repeat':-1})]]) + feed([[]]) + feed([[:sign ]]) -- Invoke wildmenu. + screen:sleep(30) -- Allow some timer activity. + screen:expect([[ + | + ~ | + ~ | + define jump list > | + :sign define^ | + ]]) + end) + + it('with laststatus=0, :vsplit, :term #2255', 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 + + if iswin() then + set_shell_powershell() + else + command('set shell=sh') + end + + command('set laststatus=0') + command('vsplit') + command('term') + + -- Check for a shell prompt to verify that the terminal loaded. + retry(nil, nil, function() + if iswin() then + eq('PS', eval("matchstr(join(getline(1, '$')), 'PS')")) + else + eq('$', eval([[matchstr(getline(1), '\$')]])) + end end) + + feed([[]]) + feed([[:]]) -- Invoke wildmenu. + screen:sleep(10) -- Flush + -- Check only the last 2 lines, because the shell output is + -- system-dependent. + screen:expect('! # & < = > @ > \n:!^', nil, nil, nil, true) end) end) -- cgit From a31482db4dcaa479b09e2683037fee3d6ee56408 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 03:34:38 +0200 Subject: terminal: block redraw during c_CTRL-D Unlike the normal wildmenu, the CTRL-D wild-list is not restored by statusline redraw. (Semantics: ^D is controlled by 'wildoptions' option, so it's in the "wild..." family.) TODO: externalize the c_CTRL-D wild-list. --- test/functional/ui/wildmode_spec.lua | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/wildmode_spec.lua') diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 154f508924..42c92c4c2c 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -66,10 +66,10 @@ describe("'wildmenu'", function() else feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done]]) end - screen:sleep(50) -- Allow some output. + feed([[gg]]) feed([[:sign ]]) -- Invoke wildmenu. - screen:sleep(50) -- Allow some output. + screen:sleep(50) -- Allow some terminal output. screen:expect([[ foo | foo | @@ -77,6 +77,28 @@ describe("'wildmenu'", function() define jump list > | :sign define^ | ]]) + + -- cmdline CTRL-D display should also be preserved. + feed([[]]) + feed([[:sign ]]) -- Invoke cmdline CTRL-D. + screen:sleep(50) -- Allow some terminal output. + screen:expect([[ + :sign | + define place | + jump undefine | + list unplace | + :sign ^ | + ]]) + + -- Exiting cmdline should show the buffer. + feed([[]]) + screen:expect([[ + ^foo | + foo | + foo | + foo | + | + ]]) end) it('ignores :redrawstatus called from a timer #7108', function() -- cgit From 30996359efbba90ce03ac3de7e39f20db9ce486b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 21:10:21 +0200 Subject: clint: allow starting brace after `enum` --- test/functional/ui/wildmode_spec.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'test/functional/ui/wildmode_spec.lua') diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 42c92c4c2c..209b0bdfec 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -2,7 +2,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, command = helpers.clear, helpers.feed, helpers.command local iswin, set_shell_powershell = helpers.iswin, helpers.set_shell_powershell -local nvim_dir = helpers.nvim_dir local funcs = helpers.funcs local eq = helpers.eq local eval = helpers.eval -- cgit From 3827d5bc713d9ed149bc793f411debb5b89a4eba Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 6 Aug 2017 02:44:15 +0200 Subject: input: skip dialogs if no UI is active Treat dialogs in the same way as "silent mode" (`nvim -es`). References #1984 References #3901 --- test/functional/ui/wildmode_spec.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'test/functional/ui/wildmode_spec.lua') diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 209b0bdfec..41a751c284 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, command = helpers.clear, helpers.feed, helpers.command -local iswin, set_shell_powershell = helpers.iswin, helpers.set_shell_powershell +local iswin = helpers.iswin local funcs = helpers.funcs local eq = helpers.eq local eval = helpers.eval @@ -124,12 +124,9 @@ describe("'wildmenu'", function() -- must wait the full timeout. So make it reasonable. screen.timeout = 1000 - if iswin() then - set_shell_powershell() - else - command('set shell=sh') + if not iswin() then + command('set shell=sh') -- Need a predictable "$" prompt. end - command('set laststatus=0') command('vsplit') command('term') @@ -137,7 +134,7 @@ describe("'wildmenu'", function() -- Check for a shell prompt to verify that the terminal loaded. retry(nil, nil, function() if iswin() then - eq('PS', eval("matchstr(join(getline(1, '$')), 'PS')")) + eq('Microsoft', eval("matchstr(join(getline(1, '$')), 'Microsoft')")) else eq('$', eval([[matchstr(getline(1), '\$')]])) end -- cgit