diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-18 07:33:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 07:33:18 +0800 |
commit | 0133fbb37ab451edc08e3b01201777c58d3fd931 (patch) | |
tree | 5cce0072e43a2c7242c9bbdacddc905d8df585e4 /src/nvim/change.c | |
parent | 1453c7163d1cc94c8ff5b21dc7669195587e4461 (diff) | |
download | rneovim-0133fbb37ab451edc08e3b01201777c58d3fd931.tar.gz rneovim-0133fbb37ab451edc08e3b01201777c58d3fd931.tar.bz2 rneovim-0133fbb37ab451edc08e3b01201777c58d3fd931.zip |
vim-patch:9.0.1213: adding a line below the last one does not expand fold (#21869)
Problem: Adding a line below the last one does not expand fold.
Solution: Do not skip mark_adjust() when adding lines below the last one.
(Brandon Simmons, closes vim/vim#11832, closes vim/vim#10698)
https://github.com/vim/vim/commit/da3dd7d857ba4fb4bf408dedd1d9d6a2d5e2ae9f
Co-authored-by: Brandon Simmons <simmsbra@gmail.com>
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r-- | src/nvim/change.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index e8c4af9879..06696610b0 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -418,14 +418,7 @@ void appended_lines(linenr_T lnum, linenr_T count) /// Like appended_lines(), but adjust marks first. void appended_lines_mark(linenr_T lnum, long count) { - // Skip mark_adjust when adding a line after the last one, there can't - // be marks there. But it's still needed in diff mode. - if (lnum + count < curbuf->b_ml.ml_line_count || curwin->w_p_diff) { - mark_adjust(lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0L, kExtmarkUndo); - } else { - extmark_adjust(curbuf, lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0L, - kExtmarkUndo); - } + mark_adjust(lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0L, kExtmarkUndo); changed_lines(lnum + 1, 0, lnum + 1, (linenr_T)count, true); } @@ -1694,13 +1687,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) } // Postpone calling changed_lines(), because it would mess up folding // with markers. - // Skip mark_adjust when adding a line after the last one, there can't - // be marks there. But still needed in diff mode. - if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count - || curwin->w_p_diff) { - mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L, - kExtmarkNOOP); - } + mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L, kExtmarkNOOP); did_append = true; } else { // In MODE_VREPLACE state we are starting to replace the next line. |