Mercurial > vim
changeset 27754:1f37e5082343 v8.2.4403
patch 8.2.4403: ml_get error with nested folds and deleting lines
Commit: https://github.com/vim/vim/commit/943773783384a5ff63f57769d37ddabf8156fe1e
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 16 20:30:52 2022 +0000
patch 8.2.4403: ml_get error with nested folds and deleting lines
Problem: ml_get error with nested folds and deleting lines.
Solution: Correct the last line number before calling hasFoldingWin().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Feb 2022 21:45:03 +0100 |
parents | 30b81ad0e33f |
children | 370e4d6397da |
files | src/change.c src/version.c |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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,