summaryrefslogtreecommitdiffstats
path: root/src/fold.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:15 +0000
commit6e9cd6b491267e6dff3e3f3f37d8af5f28e40672 (patch)
tree35661af16c4a0ef2a9a8e225d2d5cc82605ea289 /src/fold.c
parentAdding upstream version 2:9.1.0496. (diff)
downloadvim-6e9cd6b491267e6dff3e3f3f37d8af5f28e40672.tar.xz
vim-6e9cd6b491267e6dff3e3f3f37d8af5f28e40672.zip
Adding upstream version 2:9.1.0698.upstream/2%9.1.0698
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fold.c')
-rw-r--r--src/fold.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fold.c b/src/fold.c
index 2cd4dcd..3353cc5 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -1492,6 +1492,9 @@ deleteFoldRecurse(garray_T *gap)
// foldMarkAdjust() {{{2
/*
* Update line numbers of folds for inserted/deleted lines.
+ *
+ * We are adjusting the folds in the range from line1 til line2,
+ * make sure that line2 does not get smaller than line1
*/
void
foldMarkAdjust(
@@ -1505,6 +1508,8 @@ foldMarkAdjust(
// lines, set line2 so that only deleted lines have their folds removed.
if (amount == MAXLNUM && line2 >= line1 && line2 - line1 >= -amount_after)
line2 = line1 - amount_after - 1;
+ if (line2 < line1)
+ line2 = line1;
// If appending a line in Insert mode, it should be included in the fold
// just above the line.
if ((State & MODE_INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM)