From c836383d21b6d38ecf59e46e76da55ca97a4fc65 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 24 May 2024 15:04:33 +0800 Subject: vim-patch:9.1.0438: Wrong Ex command executed when :g uses '?' as delimiter (#28956) 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: vim/vim#14837 https://github.com/vim/vim/commit/3074137542961ce7b3b65c14ebde75f13f5e6147 --- test/old/testdir/test_global.vim | 11 ++++++++++- test/old/testdir/test_substitute.vim | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_global.vim b/test/old/testdir/test_global.vim index 44a8784348..8c7e7cb26b 100644 --- a/test/old/testdir/test_global.vim +++ b/test/old/testdir/test_global.vim @@ -96,7 +96,16 @@ func Test_global_newline() 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/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index bce2e6ea73..fdb0f6fc37 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -174,8 +174,8 @@ func Test_substitute_repeat() 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 -- cgit