Patch 9.0.1189
Problem:    Invalid memory access with folding and using "L".
Solution:   Prevent the cursor from moving to line zero.
Files:      src/normal.c, src/testdir/test_fold.vim


*** ../vim-9.0.1188/src/normal.c        2023-01-10 17:29:24.912481480 +0000
--- src/normal.c        2023-01-13 14:16:14.046430169 +0000
***************
*** 3729,3735 ****
                {
                    (void)hasFolding(curwin->w_cursor.lnum,
                                                &curwin->w_cursor.lnum, NULL);
!                   --curwin->w_cursor.lnum;
                }
            }
            else
--- 3729,3736 ----
                {
                    (void)hasFolding(curwin->w_cursor.lnum,
                                                &curwin->w_cursor.lnum, NULL);
!                   if (curwin->w_cursor.lnum > curwin->w_topline)
!                       --curwin->w_cursor.lnum;
                }
            }
            else
*** ../vim-9.0.1188/src/testdir/test_fold.vim   2022-12-19 15:51:40.375943469 
+0000
--- src/testdir/test_fold.vim   2023-01-13 14:14:48.446429511 +0000
***************
*** 1675,1678 ****
--- 1675,1686 ----
    bwipe!
  endfunc
  
+ func Test_indent_with_L_command()
+   " The "L" command moved the cursor to line zero, causing the text saved for
+   " undo to use line number -1, which caused trouble for undo later.
+   new
+   sil! norm 8R
 V{zf8=Lu
+   bwipe!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1188/src/version.c       2023-01-12 21:07:58.640905098 +0000
--- src/version.c       2023-01-13 14:15:03.354429628 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1189,
  /**/

-- 
All good vision statements are created by groups of people with bloated
bladders who would rather be doing anything else.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230113141824.723B11C05C6%40moolenaar.net.

Raspunde prin e-mail lui