diff options
author | Jurica Bradarić <jbradaric@users.noreply.github.com> | 2016-08-29 20:35:48 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-08-29 14:35:48 -0400 |
commit | 7fd771619f2a2e2fe6007aaa6aa9a02cbdd205bd (patch) | |
tree | 281a5df1b0fee3cf2c5866184b8216d5b21cbc02 /src/nvim/ops.c | |
parent | 10a54ad12e2d78c629220c4266066cf9b997d684 (diff) | |
download | rneovim-7fd771619f2a2e2fe6007aaa6aa9a02cbdd205bd.tar.gz rneovim-7fd771619f2a2e2fe6007aaa6aa9a02cbdd205bd.tar.bz2 rneovim-7fd771619f2a2e2fe6007aaa6aa9a02cbdd205bd.zip |
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
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 9 |
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) { |