aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/cmdline_spec.lua
diff options
context:
space:
mode:
authorJit <gelguy@gmail.com>2019-05-26 19:52:30 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-05-26 19:52:30 +0200
commit0bbaef8a99af8733cc64ff29858e17c19ed30b3c (patch)
tree988d75711bdcc8ff3d1447f75bcd607200dcdbc8 /test/functional/ui/cmdline_spec.lua
parentfc7861f0faf907fba4cd0259bc3e8665f3df473b (diff)
downloadrneovim-0bbaef8a99af8733cc64ff29858e17c19ed30b3c.tar.gz
rneovim-0bbaef8a99af8733cc64ff29858e17c19ed30b3c.tar.bz2
rneovim-0bbaef8a99af8733cc64ff29858e17c19ed30b3c.zip
UI/cmdline: check if redraw is needed after K_EVENT, K_COMMAND #9804
fixes #8490
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
-rw-r--r--test/functional/ui/cmdline_spec.lua74
1 files changed, 65 insertions, 9 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 5d563895d6..915e7ae867 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -4,20 +4,25 @@ local clear, feed = helpers.clear, helpers.feed
local source = helpers.source
local command = helpers.command
+local function new_screen(opt)
+ local screen = Screen.new(25, 5)
+ screen:attach(opt)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {reverse = true},
+ [3] = {bold = true, reverse = true},
+ [4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [5] = {bold = true, foreground = Screen.colors.SeaGreen4},
+ })
+ return screen
+end
+
local function test_cmdline(linegrid)
local screen
before_each(function()
clear()
- screen = Screen.new(25, 5)
- screen:attach({rgb=true, ext_cmdline=true, ext_linegrid=linegrid})
- screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue1},
- [2] = {reverse = true},
- [3] = {bold = true, reverse = true},
- [4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [5] = {bold = true, foreground = Screen.colors.SeaGreen4},
- })
+ screen = new_screen({rgb=true, ext_cmdline=true, ext_linegrid=linegrid})
end)
after_each(function()
@@ -758,6 +763,57 @@ local function test_cmdline(linegrid)
end
+describe('cmdline redraw', function()
+ local screen
+ before_each(function()
+ clear()
+ screen = new_screen({rgb=true})
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ it('with timer', function()
+ feed(':012345678901234567890123456789')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {3: }|
+ :012345678901234567890123|
+ 456789^ |
+ ]]}
+ command('call timer_start(0, {-> 1})')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {3: }|
+ :012345678901234567890123|
+ 456789^ |
+ ]], unchanged=true, timeout=100}
+ end)
+
+ it('with <Cmd>', function()
+ command('cmap a <Cmd>0<CR>') -- no-op
+ feed(':012345678901234567890123456789')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {3: }|
+ :012345678901234567890123|
+ 456789^ |
+ ]]}
+ feed('a')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {3: }|
+ :012345678901234567890123|
+ 456789^ |
+ ]], unchanged=true}
+ end)
+end)
+
-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
-- (which uses indexed highlights) so make sure to test both
describe('ui/ext_cmdline', function() test_cmdline(true) end)