Skip to content

Commit 56ebbab

Browse files
committed
patch 8.1.2059: fix for "x" deleting a fold has side effects
Problem: Fix for "x" deleting a fold has side effects. Solution: Fix it where the fold is included.
1 parent 4bd7823 commit 56ebbab

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/normal.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
15351535
{
15361536
if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
15371537
oap->start.col = 0;
1538-
if (hasFolding(curwin->w_cursor.lnum, NULL,
1538+
if ((curwin->w_cursor.col > 0 || oap->inclusive)
1539+
&& hasFolding(curwin->w_cursor.lnum, NULL,
15391540
&curwin->w_cursor.lnum))
15401541
curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline());
15411542
}
@@ -6001,8 +6002,7 @@ nv_right(cmdarg_T *cap)
60016002
else
60026003
{
60036004
if (has_mbyte)
6004-
curwin->w_cursor.col +=
6005-
(*mb_ptr2len)(ml_get_cursor());
6005+
curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
60066006
else
60076007
++curwin->w_cursor.col;
60086008
}
@@ -7400,13 +7400,7 @@ nv_optrans(cmdarg_T *cap)
74007400
{
74017401
if (cap->count0)
74027402
stuffnumReadbuff(cap->count0);
7403-
// If on an empty line and using 'x' and "l" is included in the
7404-
// whichwrap option, do not delete the next line.
7405-
if (cap->cmdchar == 'x' && vim_strchr(p_ww, 'l') != NULL
7406-
&& gchar_cursor() == NUL)
7407-
stuffReadbuff((char_u *)"dd");
7408-
else
7409-
stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
7403+
stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
74107404
}
74117405
}
74127406
cap->opcount = 0;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2059,
760762
/**/
761763
2058,
762764
/**/

0 commit comments

Comments
 (0)