aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorKillTheMule <github@pipsfrank.de>2017-11-05 17:11:44 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-11-05 17:11:44 +0100
commit04b3c327723587fa63f391884b8dfce44233cc77 (patch)
tree864a3debeb21bad2610972189ed03cffba7ca9a2 /test/functional/ui
parent739bc5124ad2fafdee32d33e1340a73b3778e37e (diff)
downloadrneovim-04b3c327723587fa63f391884b8dfce44233cc77.tar.gz
rneovim-04b3c327723587fa63f391884b8dfce44233cc77.tar.bz2
rneovim-04b3c327723587fa63f391884b8dfce44233cc77.zip
'inccommand': Fix matches for zero-width (#7487)
closes #7485
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/inccommand_spec.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 6646e65bad..53fd17c309 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -1791,6 +1791,42 @@ describe("'inccommand' with 'gdefault'", function()
expect("A\nA")
eq({mode='n', blocking=false}, nvim("get_mode"))
end)
+
+ it("does not crash on zero-width matches #7485", function()
+ common_setup(nil, "split", default_text)
+ command("set gdefault")
+ feed("gg")
+ feed("Vj")
+ feed(":s/\\%V")
+ eq({mode='c', blocking=false}, nvim("get_mode"))
+ feed("<Esc>")
+ eq({mode='n', blocking=false}, nvim("get_mode"))
+ end)
+
+ it("removes highlights after abort for a zero-width match", function()
+ local screen = Screen.new(30,5)
+ common_setup(screen, "nosplit", default_text)
+ command("set gdefault")
+
+ feed(":%s/\\%1c/a/")
+ screen:expect([[
+ {12:a}Inc substitution on |
+ {12:a}two lines |
+ {12:a} |
+ {15:~ }|
+ :%s/\%1c/a/^ |
+ ]])
+
+ feed("<Esc>")
+ screen:expect([[
+ Inc substitution on |
+ two lines |
+ ^ |
+ {15:~ }|
+ |
+ ]])
+ end)
+
end)
describe(":substitute", function()