diff src/normal.c @ 18114:90b0af9ba4ff v8.1.2052

patch 8.1.2052: using "x" before a closed fold may delete that fold Commit: https://github.com/vim/vim/commit/7a9bd7c1e0ce1baf5a02daf36eeae3638aa315c7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 17 22:42:55 2019 +0200 patch 8.1.2052: using "x" before a closed fold may delete that fold Problem: Using "x" before a closed fold may delete that fold. Solution: Do not translate 'x' do "dl". (Christian Brabandt, closes https://github.com/vim/vim/issues/4927)
author Bram Moolenaar <Bram@vim.org>
date Tue, 17 Sep 2019 22:45:05 +0200
parents af0b4ffab794
children aeabc666a119
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -7381,8 +7381,8 @@ nv_optrans(cmdarg_T *cap)
 
     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;
@@ -7400,7 +7400,13 @@ nv_optrans(cmdarg_T *cap)
 	{
 	    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;