mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.1621: crash when using submatch(0, 1) in substitute()
Problem: Crash when using submatch(0, 1) in substitute(). Solution: Increment reference count. (closes vim/vim#6887)8a0dcf4330
N/A patches for version.c: vim-patch:8.2.2674: Motif: cancelling the font dialog resets the font Problem: Motif: cancelling the font dialog resets the font. Solution: When no font is selected to not change the font. (closes vim/vim#7825, closes vim/vim#8035) Fix compiler warnings.9dbe701fe1
This commit is contained in:
parent
375f957af6
commit
4564f2c54f
@ -7139,6 +7139,7 @@ list_T *reg_submatch_list(int no)
|
||||
tv_list_append_string(list, s, (const char *)rsm.sm_match->endp[no] - s);
|
||||
}
|
||||
|
||||
tv_list_ref(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -746,3 +746,12 @@ func Test_sub_beyond_end()
|
||||
call assert_equal('#', getline(1))
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_submatch_list_concatenate()
|
||||
let pat = 'A\(.\)'
|
||||
let Rep = {-> string([submatch(0, 1)] + [[submatch(1)]])}
|
||||
" call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]")
|
||||
call assert_equal(substitute('A1', pat, Rep, ''), "[['A1'], ['1']]")
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user