To: vim_dev@googlegroups.com Subject: Patch 8.2.4403 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4403 Problem: ml_get error with nested folds and deleting lines. Solution: Correct the last line number before calling hasFoldingWin(). Files: src/change.c *** ../vim-8.2.4402/src/change.c 2022-02-16 20:30:47.948098690 +0000 --- src/change.c 2022-02-16 21:49:40.014243855 +0000 *************** *** 552,557 **** --- 552,559 ---- { 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,567 **** #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); // 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 --- 563,569 ---- #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, 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,578 **** 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) wp->w_cline_folded = i; // If the changed line is in a range of previously folded lines, --- 573,580 ---- i = hasFoldingWin(wp, lnum, &lnum, NULL, FALSE, NULL); if (wp->w_cursor.lnum == lnum) wp->w_cline_folded = i; ! 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, *** ../vim-8.2.4402/src/version.c 2022-02-16 21:48:20.966418934 +0000 --- src/version.c 2022-02-16 21:50:39.306114351 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4403, /**/ -- "I simultaneously try to keep my head in the clouds and my feet on the ground. Sometimes it's a stretch, though." -- Larry Wall /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///