forked from aniani/vim
patch 8.2.0002: "dj" only deletes first line of closed fold
Problem: "dj" only deletes first line of closed fold. Solution: Adjust last line of operator for linewise motion. (closes #5354)
This commit is contained in:
parent
74ee5e2384
commit
3b68123cd2
@ -4233,7 +4233,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
|||||||
{
|
{
|
||||||
if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
|
if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
|
||||||
oap->start.col = 0;
|
oap->start.col = 0;
|
||||||
if ((curwin->w_cursor.col > 0 || oap->inclusive)
|
if ((curwin->w_cursor.col > 0 || oap->inclusive
|
||||||
|
|| oap->motion_type == MLINE)
|
||||||
&& hasFolding(curwin->w_cursor.lnum, NULL,
|
&& hasFolding(curwin->w_cursor.lnum, NULL,
|
||||||
&curwin->w_cursor.lnum))
|
&curwin->w_cursor.lnum))
|
||||||
curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline());
|
curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline());
|
||||||
|
@ -769,3 +769,28 @@ func Test_fold_delete_with_marker_and_whichwrap()
|
|||||||
set fdm& ww&
|
set fdm& ww&
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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
|
||||||
|
@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2,
|
||||||
/**/
|
/**/
|
||||||
1,
|
1,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user