aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c9
1 files changed, 7 insertions, 2 deletions
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) {