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 vim/vim#5354)
3b68123cd2
This commit is contained in:
Jan Edmund Lazo 2019-12-13 21:17:57 -05:00
parent 251b20e533
commit 63cd5dd0ae
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 28 additions and 1 deletions

View File

@ -1553,7 +1553,9 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (!VIsual_active) {
if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
oap->start.col = 0;
if ((curwin->w_cursor.col > 0 || oap->inclusive)
if ((curwin->w_cursor.col > 0
|| oap->inclusive
|| oap->motion_type == kMTLineWise)
&& hasFolding(curwin->w_cursor.lnum, NULL,
&curwin->w_cursor.lnum)) {
curwin->w_cursor.col = (colnr_T)STRLEN(get_cursor_line_ptr());

View File

@ -769,3 +769,28 @@ func Test_fold_delete_with_marker_and_whichwrap()
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