aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-06-18 00:09:45 +0200
committerDaniel Hahler <git@thequod.de>2019-06-18 00:18:52 +0200
commit8db93d0d83d834d736c1dddb51a4c94c89aae1be (patch)
tree9cab05aa2ad474037a697a6d3264304b33072b99 /src/nvim/eval.c
parent9485061baac53e5a6f07ddf05751b152078a1ab1 (diff)
downloadrneovim-8db93d0d83d834d736c1dddb51a4c94c89aae1be.tar.gz
rneovim-8db93d0d83d834d736c1dddb51a4c94c89aae1be.tar.bz2
rneovim-8db93d0d83d834d736c1dddb51a4c94c89aae1be.zip
vim-patch:8.0.1053: setline() does not work on startup
Problem: setline() does not work on startup. (Manuel Ortega) Solution: Do not check for ml_mfp to be set for the current buffer. (Christian Brabandt) https://github.com/vim/vim/commit/9d954207e2cc807b475bb04f8b59ef5bb3772d99
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c5
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;
}