aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/messages_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-09-08 14:57:45 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-09-08 15:24:14 +0200
commitc705e3fb0b70887aaebe4973ce02acc6be45eb97 (patch)
treed09e86ecd2f61d8e93175bceefa1468df0c586e3 /test/functional/ui/messages_spec.lua
parent19993bca4afaade5d0fbaf132ff66064370bacb0 (diff)
downloadrneovim-c705e3fb0b70887aaebe4973ce02acc6be45eb97.tar.gz
rneovim-c705e3fb0b70887aaebe4973ce02acc6be45eb97.tar.bz2
rneovim-c705e3fb0b70887aaebe4973ce02acc6be45eb97.zip
update tests for new resize behavior (resize at pager, but not at :!cmd)
Diffstat (limited to 'test/functional/ui/messages_spec.lua')
-rw-r--r--test/functional/ui/messages_spec.lua117
1 files changed, 117 insertions, 0 deletions
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 90874a92ef..875e4092a6 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -6,6 +6,7 @@ local eq = helpers.eq
local command = helpers.command
local set_method_error = helpers.set_method_error
local meths = helpers.meths
+local async_meths = helpers.async_meths
local test_build_dir = helpers.test_build_dir
local nvim_prog = helpers.nvim_prog
local iswin = helpers.iswin
@@ -1073,6 +1074,7 @@ describe('pager', function()
[9] = {foreground = tonumber('0x00000c'), background = Screen.colors.Grey100},
[10] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff')},
[11] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber ('0x2b8452')},
+ [12] = {bold = true, reverse = true},
})
command("set more")
@@ -1392,4 +1394,119 @@ aliquip ex ea commodo consequat.]])
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]]}
end)
+
+ it('with :!cmd does not crash on resize', function()
+ feed(':!sleep 1<cr>')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {12: }|
+ :!sleep 1 |
+ |
+ ]]}
+
+ -- not processed while command is executing
+ async_meths.ui_try_resize(35, 5)
+
+ -- TODO(bfredl): ideally it should be processed just
+ -- before the "press ENTER" prompt though
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {12: }|
+ :!sleep 1 |
+ |
+ {4:Press ENTER or type command to cont}|
+ {4:inue}^ |
+ ]]}
+
+ feed('<cr>')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ end)
+
+ it('can be resized', function()
+ feed(':lua error(_G.x)<cr>')
+ screen:expect{grid=[[
+ {2:E5105: Error while calling lua chun}|
+ {2:k: [string "<VimL compiled string>"}|
+ {2:]:1: Lorem ipsum dolor sit amet, co}|
+ {2:nsectetur} |
+ {2:adipisicing elit, sed do eiusmod te}|
+ {2:mpor} |
+ {2:incididunt ut labore et dolore magn}|
+ {4:-- More --}^ |
+ ]]}
+
+ -- responds to resize, but text is not reflown
+ screen:try_resize(45, 5)
+ screen:expect{grid=[[
+ {2:nsectetur} |
+ {2:adipisicing elit, sed do eiusmod te} |
+ {2:mpor} |
+ {2:incididunt ut labore et dolore magn} |
+ {4:-- More --}^ |
+ ]]}
+
+ -- can create empty space, as the command hasn't output the text below yet.
+ -- text is not reflown; existing lines get cut
+ screen:try_resize(30, 12)
+ screen:expect{grid=[[
+ {2:E5105: Error while calling lua}|
+ {2:k: [string "<VimL compiled str}|
+ {2:]:1: Lorem ipsum dolor sit ame}|
+ {2:nsectetur} |
+ {2:adipisicing elit, sed do eiusm}|
+ {2:mpore} |
+ {2:incididunt ut labore et dolore}|
+ {2: magn} |
+ |
+ |
+ |
+ {4:-- More --}^ |
+ ]]}
+
+ -- continues in a mostly consistent state, but only new lines are
+ -- wrapped at the new screen size.
+ feed('<cr>')
+ screen:expect{grid=[[
+ {2:k: [string "<VimL compiled str}|
+ {2:]:1: Lorem ipsum dolor sit ame}|
+ {2:nsectetur} |
+ {2:adipisicing elit, sed do eiusm}|
+ {2:mpore} |
+ {2:incididunt ut labore et dolore}|
+ {2: magna aliqua.} |
+ {2:Ut enim ad minim veniam, quis }|
+ {2:nostrud xercitation} |
+ {2:ullamco laboris nisi ut} |
+ {2:aliquip ex ea commodo consequa}|
+ {4:-- More --}^ |
+ ]]}
+
+ feed('q')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ end)
end)