aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-24 18:19:24 +0800
committerGitHub <noreply@github.com>2024-08-24 10:19:24 +0000
commit91ce0c3ddda7659de9adc85601d6a7d6cf05f681 (patch)
tree92b8ca3bcf6d2ffaaa6b65d4da6cc1ae67e7b131 /test
parentbb4b6b427c1952b4a9b72f406b913ec59f0d4d22 (diff)
downloadrneovim-91ce0c3ddda7659de9adc85601d6a7d6cf05f681.tar.gz
rneovim-91ce0c3ddda7659de9adc85601d6a7d6cf05f681.tar.bz2
rneovim-91ce0c3ddda7659de9adc85601d6a7d6cf05f681.zip
vim-patch:9.1.0692: Wrong patlen value in ex_substitute() (#30131)
Problem: Wrong patlen value in ex_substitute() (after 9.1.0426). Solution: Compute patlen after finding end separator. (zeertzjq) Add a more explicit test. The test already passes as the only case where a overlarge patlen value matters was fixed by patch 9.1.0689. closes: vim/vim#15565 https://github.com/vim/vim/commit/d1c8d2de4b9fa44b3d2b39b7ed8b92846c5502b7
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_search.vim31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/old/testdir/test_search.vim b/test/old/testdir/test_search.vim
index 077a7d03a3..b62c2b2e5f 100644
--- a/test/old/testdir/test_search.vim
+++ b/test/old/testdir/test_search.vim
@@ -1668,6 +1668,37 @@ func Test_search_with_no_last_pat()
call delete('Xresult')
endfunc
+" Test for using the last substitute pattern without last search pattern.
+func Test_search_with_last_substitute_pat()
+ let lines =<< trim [SCRIPT]
+ new
+ set shortmess+=S
+ call setline(1, repeat(['foofoo'], 3))
+ %s/foo/bar/
+ call assert_equal(repeat(['barfoo'], 3), getline(1, '$'))
+
+ call cursor(1, 1)
+ call assert_equal("/foo", execute('call feedkeys("/\r", "tx")', '')->trim())
+ call assert_equal([0, 1, 4, 0], getpos('.'))
+
+ if has('rightleft')
+ set rightleft rightleftcmd=search
+ call cursor(1, 1)
+ call assert_equal("oof/", execute('call feedkeys("/\r", "tx")', '')->trim())
+ call assert_equal([0, 1, 4, 0], getpos('.'))
+ endif
+
+ call writefile(v:errors, 'Xresult')
+ qall!
+ [SCRIPT]
+ call writefile(lines, 'Xscript', 'D')
+
+ if RunVim([], [], '--clean -S Xscript')
+ call assert_equal([], readfile('Xresult'))
+ endif
+ call delete('Xresult')
+endfunc
+
" Test for using tilde (~) atom in search. This should use the last used
" substitute pattern
func Test_search_tilde_pat()