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 -- b...@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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220216215655.E01191C0FE0%40moolenaar.net.

Raspunde prin e-mail lui