diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-06-04 20:14:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-06-04 20:14:07 +0200 |
commit | 82faa259cc42379f2a17d598a2a39d14048685b0 (patch) | |
tree | b81ddb7d30034aa1741d75769a33ff5264724e8d /src | |
parent | 888ccac8902cee186fbd47e971881f6d9b19c068 (diff) | |
download | vim-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')
-rw-r--r-- | src/misc1.c | 12 | ||||
-rw-r--r-- | src/ops.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/misc1.c b/src/misc1.c index 9fa85781a..796996893 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -1425,8 +1425,11 @@ open_line( == FAIL) goto theend; /* Postpone calling changed_lines(), because it would mess up folding - * with markers. */ - mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); + * with markers. + * Skip mark_adjust when adding a line after the last one, there can't + * be marks there. */ + if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count) + mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); did_append = TRUE; } #ifdef FEAT_VREPLACE @@ -2861,7 +2864,10 @@ appended_lines(linenr_T lnum, long count) void appended_lines_mark(linenr_T lnum, long count) { - mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); + /* Skip mark_adjust when adding a line after the last one, there can't + * be marks there. */ + if (lnum + count < curbuf->b_ml.ml_line_count) + mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); changed_lines(lnum + 1, 0, lnum + 1, count); } @@ -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 */ diff --git a/src/version.c b/src/version.c index 1e7c2f290..c6ebdc45b 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1896, +/**/ 1895, /**/ 1894, |