From 299331490eb037d355e58efbff8e9a7f3e026431 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 1 Sep 2019 22:04:20 -0700 Subject: API: nvim_buf_set_lines: handle 'nomodifiable' #10910 --- src/nvim/api/buffer.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 41d7d8ba6b..690497159a 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -453,6 +453,11 @@ void nvim_buf_set_lines(uint64_t channel_id, aco_save_T aco; aucmd_prepbuf(&aco, (buf_T *)buf); + if (!MODIFIABLE(buf)) { + api_set_error(err, kErrorTypeException, "Buffer is not 'modifiable'"); + goto end; + } + if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) { api_set_error(err, kErrorTypeException, "Failed to save undo information"); goto end; -- cgit