diff options
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d426fb2064..5ab1e0ebbe 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14854,7 +14854,10 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum, typval_T *lines, buf_T *curbuf_save; int is_curbuf = buf == curbuf; - if (buf == NULL || buf->b_ml.ml_mfp == NULL || lnum < 1) { + // When using the current buffer ml_mfp will be set if needed. Useful when + // setline() is used on startup. For other buffers the buffer must be + // loaded. + if (buf == NULL || (!is_curbuf && buf->b_ml.ml_mfp == NULL) || lnum < 1) { rettv->vval.v_number = 1; // FAIL return; } |