aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-05-22 21:53:43 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2016-05-24 22:11:37 +0200
commit5cc87d4dabd02167117be7a978b5c8faaa975419 (patch)
treec8d54327f76fbc7422d3fec0a7e91f85c8da41ca /test/functional
parent61e8adb25e6f37c3c9df0dd8f4fea5e23b62bacd (diff)
downloadrneovim-5cc87d4dabd02167117be7a978b5c8faaa975419.tar.gz
rneovim-5cc87d4dabd02167117be7a978b5c8faaa975419.tar.bz2
rneovim-5cc87d4dabd02167117be7a978b5c8faaa975419.zip
cmdline: Redraw the cmdline after processing events
vim-patch:7.4.1603 TODO(bfredl): if we allow events in HITRETURN and ASKMORE states, we need to add the necessary redraws as well.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/eval/timer_spec.lua23
-rw-r--r--test/functional/ui/screen.lua6
2 files changed, 28 insertions, 1 deletions
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index df0a55e462..611113f560 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')
+local Screen = require('test.functional.ui.screen')
local ok, feed, eq, eval = helpers.ok, helpers.feed, helpers.eq, helpers.eval
local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run
local clear, execute, funcs = helpers.clear, helpers.execute, helpers.funcs
@@ -103,4 +104,26 @@ describe('timers', function()
eq(2,eval("g:val2"))
end)
+ it("doesn't mess up the cmdline", function()
+ local screen = Screen.new(40, 6)
+ screen:attach()
+ screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}})
+ source([[
+ func! MyHandler(timer)
+ echo "evil"
+ endfunc
+ ]])
+ execute("call timer_start(100, 'MyHandler', {'repeat': 1})")
+ feed(":good")
+ screen:sleep(200)
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :good^ |
+ ]])
+ end)
+
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 6372cbe081..99b85caf10 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -290,6 +290,10 @@ If everything else fails, use Screen:redraw_debug to help investigate what is
end
end
+function Screen:sleep(ms)
+ pcall(function() self:wait(function() return "error" end, ms) end)
+end
+
function Screen:_redraw(updates)
for _, update in ipairs(updates) do
-- print('--')
@@ -501,7 +505,7 @@ end
function Screen:snapshot_util(attrs, ignore)
-- util to generate screen test
- pcall(function() self:wait(function() return "error" end, 250) end)
+ self:sleep(250)
self:print_snapshot(attrs, ignore)
end