From 619eb32c75e854737cd2ca928dadd6f7367c6533 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 14 Jun 2022 10:55:04 +0800 Subject: fix(inccommand): never preview if parsing command failed (#18944) `errormsg` is not always set when parsing the command failed (e.g. when the range contains invalid marks). Check the return value is better. --- test/functional/ui/inccommand_spec.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/functional/ui') diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index a310069636..dfbe724026 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -2947,6 +2947,32 @@ it(':substitute with inccommand, allows :redraw before first separator is typed ]]) end) +it(':substitute with inccommand, does nothing if range contains invalid marks', function() + local screen = Screen.new(30, 6) + clear() + command('set undolevels=-1') + common_setup(screen, 'split', 'test') + feed([[:'a,'bs]]) + screen:expect([[ + test | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :'a,'bs^ | + ]]) + feed('/') + screen:expect([[ + test | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :'a,'bs/^ | + ]]) + eq('', eval('v:errmsg')) +end) + it(":substitute doesn't crash with inccommand, if undo is empty #12932", function() local screen = Screen.new(10,5) clear() -- cgit