aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-16 17:44:14 +0800
committerGitHub <noreply@github.com>2023-04-16 17:44:14 +0800
commitb28683d25281847716ca0003cecedb3f3a34d089 (patch)
treeab5e93ad8c642af51d209bafb372e48134d7a210 /test
parentc54592bfdacf08823a03d5aa251f49b906f3157d (diff)
downloadrneovim-b28683d25281847716ca0003cecedb3f3a34d089.tar.gz
rneovim-b28683d25281847716ca0003cecedb3f3a34d089.tar.bz2
rneovim-b28683d25281847716ca0003cecedb3f3a34d089.zip
vim-patch:9.0.0947: invalid memory access in substitute with function (#23126)
Problem: Invalid memory access in substitute with function that goes to another file. Solution: Check for text locked in CTRL-W gf. https://github.com/vim/vim/commit/cc762a48d42b579fb7bdec2c614636b830342dd5 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_substitute.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim
index b2abbae168..f15ef122ec 100644
--- a/test/old/testdir/test_substitute.vim
+++ b/test/old/testdir/test_substitute.vim
@@ -1090,6 +1090,25 @@ func Test_sub_edit_scriptfile()
bwipe!
endfunc
+" This was editing another file from the expression.
+func Test_sub_expr_goto_other_file()
+ call writefile([''], 'Xfileone', 'D')
+ enew!
+ call setline(1, ['a', 'b', 'c', 'd',
+ \ 'Xfileone zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'])
+
+ func g:SplitGotoFile()
+ exe "sil! norm 0\<C-W>gf"
+ return ''
+ endfunc
+
+ $
+ s/\%')/\=g:SplitGotoFile()
+
+ delfunc g:SplitGotoFile
+ bwipe!
+endfunc
+
" Test for the 2-letter and 3-letter :substitute commands
func Test_substitute_short_cmd()
new