Merge #11076 from blueyed/fix-fold-patches

Fix fold patches: vim-patch:8.1.2052, vim-patch:8.1.2059
fix #11002
This commit is contained in:
Justin M. Keyes
2019-09-22 12:32:46 -07:00
committed by GitHub
2 changed files with 19 additions and 9 deletions

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;
} }
} }
} }

View File

@@ -756,3 +756,15 @@ func Test_fold_delete_with_marker()
bwipe! bwipe!
bwipe! bwipe!
endfunc 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