From a9665bb12cd8cbacbc6ef6df66c1989b0c6f9fcc Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 30 Mar 2022 05:25:00 +0800 Subject: fix(event-loop): duplicate display updating logic in vgetorpeek() (#17913) --- test/functional/api/vim_spec.lua | 12 +++++++++ test/functional/ui/input_spec.lua | 44 ++++++++++++++++++++++++++++++++ test/functional/vimscript/timer_spec.lua | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index ed9d915954..e6ed0f939b 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -1589,6 +1589,18 @@ describe('API', function() feed(':digraphs') eq({mode='rm', blocking=true}, nvim("get_mode")) end) + + it('after mapping returns blocking=false #17257', function() + command('nnoremap ') + feed('') + eq({mode='n', blocking=false}, nvim("get_mode")) + end) + + it('after empty string mapping returns blocking=false #17257', function() + command('nnoremap ""') + feed('') + eq({mode='n', blocking=false}, nvim("get_mode")) + end) end) describe('RPC (K_EVENT)', function() diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index f5ae228b1e..9df7531016 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -320,3 +320,47 @@ describe("event processing and input", function() eq({'notification', 'stop', {}}, next_msg()) end) end) + +describe('display is updated', function() + local screen + before_each(function() + screen = Screen.new(60, 8) + screen:set_default_attr_ids({ + [1] = {bold = true, foreground = Screen.colors.Blue1}, -- NonText + [2] = {bold = true}, -- ModeMsg + }) + screen:attach() + end) + + it('in Insert mode after mapping #17911', function() + command('imap test ') + command('imap abctest') + feed('i') + screen:expect([[ + abc | + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:-- INSERT --} | + ]]) + end) + + it('in Insert mode after empty string mapping #17911', function() + command('imap test ""') + command('imap abctest') + feed('i') + screen:expect([[ + abc | + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:-- INSERT --} | + ]]) + end) +end) diff --git a/test/functional/vimscript/timer_spec.lua b/test/functional/vimscript/timer_spec.lua index 25e46062b7..20f2afb20f 100644 --- a/test/functional/vimscript/timer_spec.lua +++ b/test/functional/vimscript/timer_spec.lua @@ -273,7 +273,7 @@ describe('timers', function() eq("Vim(call):E48: Not allowed in sandbox", exc_exec("sandbox call timer_start(0, 'Scary')")) end) - it('can be triggered after an empty string mapping', function() + it('can be triggered after an empty string mapping #17257', function() local screen = Screen.new(40, 6) screen:attach() command([=[imap [timer_start(0, { _ -> execute("throw 'x'", "") }), ''][-1]]=]) -- cgit