FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
+ {
can_unload = FALSE;
+ break;
+ }
}
if (!can_unload)
EMSG(_("E937: Attempt to delete a buffer that is in use"));
/* mark cursor position as being invalid */
curwin->w_valid = 0;
+ buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
+ curbuf->b_last_cursor.col, TRUE);
+
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
{
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('%')