Mercurial > vim
changeset 18128:aeabc666a119 v8.1.2059
patch 8.1.2059: fix for "x" deleting a fold has side effects
Commit: https://github.com/vim/vim/commit/56ebbabea1d8409ba67127b9674f6c714739c8e0
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 20 13:40:14 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 20 Sep 2019 13:45:04 +0200 |
parents | 3a7a8ae0864f |
children | 52078b0635f7 |
files | src/normal.c src/version.c |
diffstat | 2 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/normal.c +++ b/src/normal.c @@ -1535,7 +1535,8 @@ do_pending_operator(cmdarg_T *cap, int o { if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL)) oap->start.col = 0; - if (hasFolding(curwin->w_cursor.lnum, NULL, + if ((curwin->w_cursor.col > 0 || oap->inclusive) + && hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline()); } @@ -6001,8 +6002,7 @@ nv_right(cmdarg_T *cap) else { if (has_mbyte) - curwin->w_cursor.col += - (*mb_ptr2len)(ml_get_cursor()); + curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor()); else ++curwin->w_cursor.col; } @@ -7400,13 +7400,7 @@ nv_optrans(cmdarg_T *cap) { if (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_u *)"dd"); - else - stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); + stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); } } cap->opcount = 0;