From e5c22f6347771ed2f303a6f29811201234a34b6a Mon Sep 17 00:00:00 2001 From: disrupted Date: Mon, 10 May 2021 13:31:06 +0200 Subject: [PATCH 1/2] Fix nvim_buf_set_lines --- src/nvim/api/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 665c622c98..ebc9aeb75f 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -516,7 +516,7 @@ void nvim_buf_set_lines(uint64_t channel_id, kExtmarkNOOP); extmark_splice(curbuf, (int)start-1, 0, (int)(end-start), 0, - deleted_bytes, (int)(end+extra-1), 0, inserted_bytes, + deleted_bytes, (int)new_len, 0, inserted_bytes, kExtmarkUndo); changed_lines((linenr_T)start, 0, (linenr_T)end, (long)extra, true); From 81dc64796106e61f197822f9b8d2f2ae37174559 Mon Sep 17 00:00:00 2001 From: disrupted Date: Mon, 10 May 2021 13:47:22 +0200 Subject: [PATCH 2/2] Apply patch from clason --- src/nvim/ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/ops.c b/src/nvim/ops.c index ca68ef04b0..0ed116c17f 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -6307,7 +6307,7 @@ bcount_t get_region_bytecount(buf_T *buf, linenr_T start_lnum, linenr_T end_lnum, colnr_T start_col, colnr_T end_col) { - linenr_T max_lnum = buf->b_ml.ml_line_lnum; + linenr_T max_lnum = buf->b_ml.ml_line_count; if (start_lnum > max_lnum) { return 0; }