diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-16 20:30:52 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-16 20:30:52 +0000 |
commit | 943773783384a5ff63f57769d37ddabf8156fe1e (patch) | |
tree | e511d6f49832d0ac228bbe8fe4c269f936e8a977 | |
parent | ae6f1d8b14c2f63811ee83ef14e32086fb3e9b83 (diff) | |
download | vim-git-943773783384a5ff63f57769d37ddabf8156fe1e.tar.gz |
patch 8.2.4403: ml_get error with nested folds and deleting linesv8.2.4403
Problem: ml_get error with nested folds and deleting lines.
Solution: Correct the last line number before calling hasFoldingWin().
-rw-r--r-- | src/change.c | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/change.c b/src/change.c index 771f7675b..d1ecb60bb 100644 --- a/src/change.c +++ b/src/change.c @@ -552,6 +552,8 @@ changed_common( { if (wp->w_buffer == curbuf) { + linenr_T last = lnume + xtra - 1; // last line after the change + // Mark this window to be redrawn later. if (wp->w_redr_type < VALID) wp->w_redr_type = VALID; @@ -561,7 +563,7 @@ changed_common( #ifdef FEAT_FOLDING // Update the folds for this window. Can't postpone this, because // a following operator might work on the whole fold: ">>dd". - foldUpdate(wp, lnum, lnume + xtra - 1); + foldUpdate(wp, lnum, last); // The change may cause lines above or below the change to become // included in a fold. Set lnum/lnume to the first/last line that @@ -571,8 +573,8 @@ changed_common( i = hasFoldingWin(wp, lnum, &lnum, NULL, FALSE, NULL); if (wp->w_cursor.lnum == lnum) wp->w_cline_folded = i; - i = hasFoldingWin(wp, lnume, NULL, &lnume, FALSE, NULL); - if (wp->w_cursor.lnum == lnume) + i = hasFoldingWin(wp, last, NULL, &last, FALSE, NULL); + if (wp->w_cursor.lnum == last) wp->w_cline_folded = i; // If the changed line is in a range of previously folded lines, diff --git a/src/version.c b/src/version.c index e1ecbac89..b788e12e3 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4403, +/**/ 4402, /**/ 4401, |