Patch 8.2.1702
Problem:    Crash when using undo after deleting folded lines.
Solution:   Check for NULL pointer. (closes #6968)
Files:      src/fold.c, src/testdir/test_fold.vim


*** ../vim-8.2.1701/src/fold.c  2020-09-01 21:20:11.918075824 +0200
--- src/fold.c  2020-09-17 19:34:24.462489494 +0200
***************
*** 2422,2429 ****
                                                              && flp->lvl > 0)
      {
        (void)foldFind(gap, startlnum - 1, &fp);
!       if (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
!                                                  || fp->fd_top >= startlnum)
            fp = NULL;
      }
  
--- 2422,2429 ----
                                                              && flp->lvl > 0)
      {
        (void)foldFind(gap, startlnum - 1, &fp);
!       if (fp != NULL && (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
!                                                  || fp->fd_top >= startlnum))
            fp = NULL;
      }
  
*** ../vim-8.2.1701/src/testdir/test_fold.vim   2020-08-12 18:50:31.879655802 
+0200
--- src/testdir/test_fold.vim   2020-09-17 19:33:52.658598036 +0200
***************
*** 816,819 ****
--- 816,838 ----
    close!
  endfunc
  
+ func Test_undo_fold_deletion()
+   new
+   set fdm=marker
+   let lines =<< trim END
+       " {{{
+       " }}}1
+       " {{{
+   END
+   call setline(1, lines)
+   3d
+   g/"/d
+   undo
+   redo
+   eval getline(1, '$')->assert_equal([''])
+ 
+   set fdm&vim
+   bwipe!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1701/src/version.c       2020-09-16 23:23:33.030882137 +0200
--- src/version.c       2020-09-17 19:32:42.686838498 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1702,
  /**/

-- 
To keep milk from turning sour: Keep it in the cow.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202009171750.08HHoHm82460482%40masaka.moolenaar.net.

Raspunde prin e-mail lui