From 7fd771619f2a2e2fe6007aaa6aa9a02cbdd205bd Mon Sep 17 00:00:00 2001 From: Jurica Bradarić Date: Mon, 29 Aug 2016 20:35:48 +0200 Subject: vim-patch:7.4.1896 (#5258) Problem: Invoking mark_adjust() when adding a new line below the last line is pointless. Solution: Skip calling mark_adjust() when appending below the last line. https://github.com/vim/vim/commit/82faa259cc42379f2a17d598a2a39d14048685b0 --- src/nvim/ops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/nvim/ops.c') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 990b95829a..0aae7f5c46 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3110,8 +3110,13 @@ error: if (dir == FORWARD) curbuf->b_op_start.lnum++; } - mark_adjust(curbuf->b_op_start.lnum + (y_type == kMTCharWise), - (linenr_T)MAXLNUM, nr_lines, 0L); + // Skip mark_adjust when adding lines after the last one, there + // can't be marks there. + if (curbuf->b_op_start.lnum + (y_type == kMTCharWise) - 1 + nr_lines + < curbuf->b_ml.ml_line_count) { + mark_adjust(curbuf->b_op_start.lnum + (y_type == kMTCharWise), + (linenr_T)MAXLNUM, nr_lines, 0L); + } // note changed text for displaying and folding if (y_type == kMTCharWise) { -- cgit