]> granicus.if.org Git - vim/commitdiff
patch 8.1.2059: fix for "x" deleting a fold has side effects v8.1.2059
authorBram Moolenaar <Bram@vim.org>
Fri, 20 Sep 2019 11:40:14 +0000 (13:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 20 Sep 2019 11:40:14 +0000 (13:40 +0200)
Problem:    Fix for "x" deleting a fold has side effects.
Solution:   Fix it where the fold is included.

src/normal.c
src/version.c

index e83c4c0be9b19f74abb8acbe605933f321681b3d..f7a3e84dc31e1a660ebac355140129465b61404e 100644 (file)
@@ -1535,7 +1535,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
            {
                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;
index 1bfe75cafecfdd83b346bd8c49a7cfc47d9c85a5..eb2631d218705e92107aac33a93252ad478d55cd 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2059,
 /**/
     2058,
 /**/