summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-04 20:14:07 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-04 20:14:07 +0200
commit82faa259cc42379f2a17d598a2a39d14048685b0 (patch)
treeb81ddb7d30034aa1741d75769a33ff5264724e8d /src/ops.c
parent888ccac8902cee186fbd47e971881f6d9b19c068 (diff)
downloadvim-git-82faa259cc42379f2a17d598a2a39d14048685b0.tar.gz
patch 7.4.1896v7.4.1896
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.
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ops.c b/src/ops.c
index 983d9d0e6..35f2d2e95 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -3885,7 +3885,11 @@ error:
if (dir == FORWARD)
curbuf->b_op_start.lnum++;
}
- mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR),
+ /* Skip mark_adjust when adding lines after the last one, there
+ * can't be marks there. */
+ if (curbuf->b_op_start.lnum + (y_type == MCHAR) - 1 + nr_lines
+ < curbuf->b_ml.ml_line_count)
+ mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR),
(linenr_T)MAXLNUM, nr_lines, 0L);
/* note changed text for displaying and folding */