refactor: buffer_ensure_loaded()

Cherry-picked from Vim patch 8.1.1612.
This commit is contained in:
zeertzjq
2022-11-29 20:09:07 +08:00
parent 89f0987bde
commit 273358651a
2 changed files with 15 additions and 7 deletions

View File

@@ -302,13 +302,8 @@ void f_bufload(typval_T *argvars, typval_T *unused, EvalFuncData fptr)
{
buf_T *buf = get_buf_arg(&argvars[0]);
if (buf != NULL && buf->b_ml.ml_mfp == NULL) {
aco_save_T aco;
aucmd_prepbuf(&aco, buf);
swap_exists_action = SEA_NONE;
open_buffer(false, NULL, 0);
aucmd_restbuf(&aco);
if (buf != NULL) {
buffer_ensure_loaded(buf);
}
}