patch 9.1.0438: Wrong Ex command executed when :g uses '?' as delimiter
Problem: Wrong Ex command executed when :g uses '?' as delimiter and
pattern contains escaped '?'.
Solution: Don't use "*newp" when it's not allocated (zeertzjq).
closes: #14837
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_global.vim b/src/testdir/test_global.vim
index 34857b2..0f72c3c 100644
--- a/src/testdir/test_global.vim
+++ b/src/testdir/test_global.vim
@@ -116,7 +116,16 @@
close!
endfunc
-func Test_wrong_delimiter()
+" Test :g with ? as delimiter.
+func Test_global_question_delimiter()
+ new
+ call setline(1, ['aaaaa', 'b?bbb', 'ccccc', 'ddd?d', 'eeeee'])
+ g?\??delete
+ call assert_equal(['aaaaa', 'ccccc', 'eeeee'], getline(1, '$'))
+ bwipe!
+endfunc
+
+func Test_global_wrong_delimiter()
call assert_fails('g x^bxd', 'E146:')
endfunc
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index a2367cd..afdc104 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -174,8 +174,8 @@
bwipe!
endfunc
-" Test :s with ? as separator.
-func Test_substitute_question_separator()
+" Test :s with ? as delimiter.
+func Test_substitute_question_delimiter()
new
call setline(1, '??:??')
%s?\?\??!!?g