vim-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.
56ebbabea1
This commit is contained in:
Daniel Hahler
2019-09-22 20:04:34 +02:00
parent 97b82553e0
commit 6c3d34e4df

View File

@@ -1553,10 +1553,12 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (!VIsual_active) { if (!VIsual_active) {
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 (hasFolding(curwin->w_cursor.lnum, NULL, if ((curwin->w_cursor.col > 0 || oap->inclusive)
&curwin->w_cursor.lnum)) && hasFolding(curwin->w_cursor.lnum, NULL,
&curwin->w_cursor.lnum)) {
curwin->w_cursor.col = (colnr_T)STRLEN(get_cursor_line_ptr()); curwin->w_cursor.col = (colnr_T)STRLEN(get_cursor_line_ptr());
} }
}
oap->end = curwin->w_cursor; oap->end = curwin->w_cursor;
curwin->w_cursor = oap->start; curwin->w_cursor = oap->start;
@@ -5125,14 +5127,10 @@ static void nv_right(cmdarg_T *cap)
break; break;
} else if (PAST_LINE) { } else if (PAST_LINE) {
curwin->w_set_curswant = true; curwin->w_set_curswant = true;
if (virtual_active()) if (virtual_active()) {
oneright(); oneright();
else { } else {
if (has_mbyte) curwin->w_cursor.col += (*mb_ptr2len)(get_cursor_pos_ptr());
curwin->w_cursor.col +=
(*mb_ptr2len)(get_cursor_pos_ptr());
else
++curwin->w_cursor.col;
} }
} }
} }
@@ -6248,15 +6246,8 @@ static void nv_optrans(cmdarg_T *cap)
if (cap->count0) { if (cap->count0) {
stuffnumReadbuff(cap->count0); stuffnumReadbuff(cap->count0);
} }
// If on an empty line and using 'x' and "l" is included in the
// whichwrap option, do not delete the next line.
if (cap->cmdchar == 'x' && vim_strchr(p_ww, 'l') != NULL
&& gchar_cursor() == NUL) {
stuffReadbuff((char *)"dd");
} else {
stuffReadbuff(ar[strchr(str, (char)cap->cmdchar) - str]); stuffReadbuff(ar[strchr(str, (char)cap->cmdchar) - str]);
} }
}
cap->opcount = 0; cap->opcount = 0;
} }