From f19e91acd8b90eaddaaa6070db260acf8de9aa10 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 13 Sep 2022 22:08:01 +0800 Subject: vim-patch:9.0.0457: substitute prompt does not highlight an empty match (#20186) Problem: Substitute prompt does not highlight an empty match. Solution: Highlight at least one character. https://github.com/vim/vim/commit/a04f457a6c071179bac4088c9314007d39d5c5e0 --- src/nvim/testdir/test_substitute.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir/test_substitute.vim') diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index b3a80072d9..1667853575 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -1,6 +1,8 @@ " Tests for the substitute (:s) command source shared.vim +source check.vim +source screendump.vim func Test_multiline_subst() enew! @@ -668,6 +670,21 @@ func Test_sub_cmd_9() bw! endfunc +func Test_sub_highlight_zero_match() + CheckRunVimInTerminal + + let lines =<< trim END + call setline(1, ['one', 'two', 'three']) + END + call writefile(lines, 'XscriptSubHighlight', 'D') + let buf = RunVimInTerminal('-S XscriptSubHighlight', #{rows: 8, cols: 60}) + call term_sendkeys(buf, ":%s/^/ /c\") + call VerifyScreenDump(buf, 'Test_sub_highlight_zer_match_1', {}) + + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) +endfunc + func Test_nocatch_sub_failure_handling() " normal error results in all replacements func Foo() -- cgit From 622968d7b389b8334ee2f2550c3a00018c4f1879 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 16 Sep 2022 19:40:52 +0800 Subject: vim-patch:9.0.0476: varargs does not work for replacement function of substitute() (#20216) Problem: Varargs does not work for replacement function of substitute(). Solution: Check the varargs flag of the function. (closes vim/vim#11142) https://github.com/vim/vim/commit/48db5dafecacced4a9e42de3f92838b2d59beb4c --- src/nvim/testdir/test_substitute.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/testdir/test_substitute.vim') diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index 1667853575..88a3c13d65 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -639,12 +639,16 @@ endfunc func SubReplacer(text, submatches) return a:text .. a:submatches[0] .. a:text endfunc +func SubReplacerVar(text, ...) + return a:text .. a:1[0] .. a:text +endfunc func SubReplacer20(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, submatches) return a:t3 .. a:submatches[0] .. a:t11 endfunc func Test_substitute_partial() call assert_equal('1foo2foo3', substitute('123', '2', function('SubReplacer', ['foo']), 'g')) + call assert_equal('1foo2foo3', substitute('123', '2', function('SubReplacerVar', ['foo']), 'g')) " 19 arguments plus one is just OK let Replacer = function('SubReplacer20', repeat(['foo'], 19)) -- cgit