aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-08 06:07:59 +0800
committerGitHub <noreply@github.com>2022-08-08 06:07:59 +0800
commit18766e742bdc8d179ff73b739a530052c9a669e5 (patch)
tree83e3b17023c1ea64db6072ce72712e7ccee71a23 /src
parent629169462a82f0fbb7a8911a4554894537d6776c (diff)
downloadrneovim-18766e742bdc8d179ff73b739a530052c9a669e5.tar.gz
rneovim-18766e742bdc8d179ff73b739a530052c9a669e5.tar.bz2
rneovim-18766e742bdc8d179ff73b739a530052c9a669e5.zip
fix(folds): fix fold remains when :delete makes buffer empty (#19673)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/change.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index c063ece907..f0ca5f3af3 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -421,12 +421,12 @@ void deleted_lines(linenr_T lnum, linenr_T count)
/// be triggered to display the cursor.
void deleted_lines_mark(linenr_T lnum, long count)
{
- // if we deleted the entire buffer, we need to implicitly add a new empty line
bool made_empty = (count > 0) && curbuf->b_ml.ml_flags & ML_EMPTY;
- mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM,
- -(linenr_T)count + (made_empty?1:0),
- kExtmarkUndo);
+ mark_adjust(lnum, (linenr_T)(lnum + count - 1), MAXLNUM, -(linenr_T)count, kExtmarkNOOP);
+ // if we deleted the entire buffer, we need to implicitly add a new empty line
+ extmark_adjust(curbuf, lnum, (linenr_T)(lnum + count - 1), MAXLNUM,
+ -(linenr_T)count + (made_empty ? 1 : 0), kExtmarkUndo);
changed_lines(lnum, 0, lnum + (linenr_T)count, (linenr_T)(-count), true);
}