forked from aniani/vim
patch 9.0.0947: invalid memory access in substitute with function
Problem: Invalid memory access in substitute with function that goes to
another file.
Solution: Check for text locked in CTRL-W gf.
This commit is contained in:
@@ -1096,6 +1096,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
|
||||
|
||||
Reference in New Issue
Block a user