if (!checkclearopq(cap->oap))
{
- /* In Vi "2D" doesn't delete the next line. Can't translate it
- * either, because "2." should also not use the count. */
+ // In Vi "2D" doesn't delete the next line. Can't translate it
+ // either, because "2." should also not use the count.
if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL)
{
cap->oap->start = curwin->w_cursor;
{
if (cap->count0)
stuffnumReadbuff(cap->count0);
- stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
+ // 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_u *)"dd");
+ else
+ stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
}
}
cap->opcount = 0;
bwipe!
bwipe!
endfunc
+
+func Test_fold_delete_with_marker_and_whichwrap()
+ new
+ let content1 = ['']
+ let content2 = ['folded line 1 "{{{1', ' test', ' test2', ' test3', '', 'folded line 2 "{{{1', ' test', ' test2', ' test3']
+ call setline(1, content1 + content2)
+ set fdm=marker ww+=l
+ normal! x
+ call assert_equal(content2, getline(1, '$'))
+ set fdm& ww&
+ bwipe!
+endfunc