diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-08-16 08:32:53 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-08-17 06:34:59 +0800 |
commit | a25dbeee10756a8f457d4632e8fda0c1cb509d61 (patch) | |
tree | 321260d40dec9db540d427bb2ce180e64aca64da /test | |
parent | 4afd4061a23c60de26818bc3847e50c791a8f26c (diff) | |
download | rneovim-a25dbeee10756a8f457d4632e8fda0c1cb509d61.tar.gz rneovim-a25dbeee10756a8f457d4632e8fda0c1cb509d61.tar.bz2 rneovim-a25dbeee10756a8f457d4632e8fda0c1cb509d61.zip |
vim-patch:9.1.0677: :keepp does not retain the substitute pattern
Problem: :keeppatterns does not retain the substitute pattern
for a :s command
Solution: preserve the last substitute pattern when used with the
:keeppatterns command modifier (Gregory Anders)
closes: vim/vim#15497
https://github.com/vim/vim/commit/3b59be4ed8a145d3188934f1a5cd85432bd2433d
Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_substitute.vim | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index f0a25b2804..90c46abe8b 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -806,7 +806,7 @@ func Test_replace_keeppatterns() a foobar -substitute foo asdf +substitute foo asdf foo one two . @@ -815,21 +815,26 @@ one two /^substitute s/foo/bar/ call assert_equal('foo', @/) - call assert_equal('substitute bar asdf', getline('.')) + call assert_equal('substitute bar asdf foo', getline('.')) /^substitute keeppatterns s/asdf/xyz/ call assert_equal('^substitute', @/) - call assert_equal('substitute bar xyz', getline('.')) + call assert_equal('substitute bar xyz foo', getline('.')) + + /^substitute + & + call assert_equal('^substitute', @/) + call assert_equal('substitute bar xyz bar', getline('.')) exe "normal /bar /e\<CR>" call assert_equal(15, col('.')) normal - keeppatterns /xyz call assert_equal('bar ', @/) - call assert_equal('substitute bar xyz', getline('.')) + call assert_equal('substitute bar xyz bar', getline('.')) exe "normal 0dn" - call assert_equal('xyz', getline('.')) + call assert_equal('xyz bar', getline('.')) close! endfunc |