vim-patch:8.1.0425: ml_get error and crash with appendbufline()

Problem:    ml_get error and crash with appendbufline(). (Masashi Iizuka)
Solution:   Set per-window buffer info. (Hirohito Higashi, closes vim/vim#3455)

9cea87c577

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit c6f0a19206)
This commit is contained in:
zeertzjq
2025-08-08 06:14:17 +08:00
committed by github-actions[bot]
parent 30db74de66
commit a65c4be2de
2 changed files with 30 additions and 0 deletions

View File

@@ -158,6 +158,33 @@ func Test_appendbufline()
exe "bwipe! " . b
endfunc
func Test_appendbufline_no_E315()
let after = [
\ 'set stl=%f ls=2',
\ 'new',
\ 'let buf = bufnr("%")',
\ 'quit',
\ 'vsp',
\ 'exec "buffer" buf',
\ 'wincmd w',
\ 'call appendbufline(buf, 0, "abc")',
\ 'redraw',
\ 'while getbufline(buf, 1)[0] =~ "^\\s*$"',
\ ' sleep 10m',
\ 'endwhile',
\ 'au VimLeavePre * call writefile([v:errmsg], "Xerror")',
\ 'au VimLeavePre * call writefile(["done"], "Xdone")',
\ 'qall!',
\ ]
if !RunVim([], after, '--clean')
return
endif
call assert_notmatch("^E315:", readfile("Xerror")[0])
call assert_equal("done", readfile("Xdone")[0])
call delete("Xerror")
call delete("Xdone")
endfunc
func Test_deletebufline()
new
let b = bufnr('%')