Patch 8.2.0002
Problem: "dj" only deletes first line of closed fold.
Solution: Adjust last line of operator for linewise motion. (closes #5354)
Files: src/ops.c, src/testdir/test_fold.vim
*** ../vim-8.2.0001/src/ops.c 2019-12-05 20:07:52.000000000 +0100
--- src/ops.c 2019-12-13 19:24:25.473823126 +0100
***************
*** 4233,4239 ****
{
if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
oap->start.col = 0;
! if ((curwin->w_cursor.col > 0 || oap->inclusive)
&& hasFolding(curwin->w_cursor.lnum, NULL,
&curwin->w_cursor.lnum))
curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline());
--- 4233,4240 ----
{
if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
oap->start.col = 0;
! if ((curwin->w_cursor.col > 0 || oap->inclusive
! || oap->motion_type == MLINE)
&& hasFolding(curwin->w_cursor.lnum, NULL,
&curwin->w_cursor.lnum))
curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline());
*** ../vim-8.2.0001/src/testdir/test_fold.vim 2019-09-20 12:49:23.000000000 +0200
--- src/testdir/test_fold.vim 2019-12-13 19:19:43.086626371 +0100
***************
*** 769,771 ****
--- 769,796 ----
set fdm& ww&
bwipe!
endfunc
+
+ func Test_fold_delete_first_line()
+ new
+ call setline(1, [
+ \ '" x {{{1',
+ \ '" a',
+ \ '" aa',
+ \ '" x {{{1',
+ \ '" b',
+ \ '" bb',
+ \ '" x {{{1',
+ \ '" c',
+ \ '" cc',
+ \ ])
+ set foldmethod=marker
+ 1
+ normal dj
+ call assert_equal([
+ \ '" x {{{1',
+ \ '" c',
+ \ '" cc',
+ \ ], getline(1,'$'))
+ bwipe!
+ set foldmethod&
+ endfunc
*** ../vim-8.2.0001/src/version.c 2019-12-13 18:05:02.332106630 +0100
--- src/version.c 2019-12-13 19:25:40.377591447 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 2,
/**/
--
XML is a nice language for computers. Not for humans.
/// Bram Moolenaar -- Br...@Moolenaar.net --
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 ///