diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-08-03 00:41:52 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-08-05 21:32:34 +0200 |
commit | c6954437277175c9e2b8eb7e7e753314725aef8b (patch) | |
tree | 7699583b08d67bb56c057186857aac50b9e4bc84 /test/functional/ui | |
parent | 55c0401dfd137a5e173d8551f763cb4c6fed56e1 (diff) | |
download | rneovim-c6954437277175c9e2b8eb7e7e753314725aef8b.tar.gz rneovim-c6954437277175c9e2b8eb7e7e753314725aef8b.tar.bz2 rneovim-c6954437277175c9e2b8eb7e7e753314725aef8b.zip |
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.
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 150 |
1 files changed, 113 insertions, 37 deletions
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 <tab> shows wildmenu completions', function() - command('set wildmode=full') - command('set wildmenu') - feed(':sign <tab>') - screen:expect([[ - | - ~ | - ~ | - define jump list > | - :sign define^ | - ]]) - end) + it(':sign <tab> shows wildmenu completions', function() + command('set wildmode=full') + command('set wildmenu') + feed(':sign <tab>') + 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<Tab><Tab><Tab>') + screen:expect([[ + | + ~ | + ~ | + join jumps | + :j^ | + ]]) + -- This would cause nvim to crash before #6650 + feed('<BS><Tab>') + 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<Tab><Tab><Tab>') - screen:expect([[ - | - ~ | - ~ | - join jumps | - :j^ | - ]]) - -- This would cause nvim to crash before #6650 - feed('<BS><Tab>') - 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<cr>]]) + end + screen:sleep(50) -- Allow some output. + feed([[<C-\><C-N>gg]]) + feed([[:sign <Tab>]]) -- 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([[<C-\><C-N>]]) + feed([[:sign <Tab>]]) -- 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([[<C-\><C-N>]]) + feed([[:<Tab>]]) -- 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) |