Patch 9.0.1189

1 view
Skip to first unread message

Bram Moolenaar

unread,
Jan 13, 2023, 9:18:31 AM1/13/23
to vim...@googlegroups.com

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 -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages