Anonymous avatar Anonymous committed 80c529a

updated for version 7.3.395
Problem: "dv?bar" in the last line deletes too much and breaks undo.
Solution: Only adjust the cursor position when it's after the last line of
the buffer. Add a test. (Christian Brabandt)

Comments (0)

Files changed (4)

 		/* Special case: gH<Del> deletes the last line. */
 		del_lines(1L, FALSE);
 		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
-		if (curwin->w_cursor.lnum > 1)
-		    --curwin->w_cursor.lnum;
+		if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
+		    curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
 	    }
 	    else
 	    {
 #endif
 
 /*
- * implementation of the format operator 'gq'
+ * Implementation of the format operator 'gq'.
  */
     void
 op_format(oap, keep_cursor)

src/testdir/test43.in

 x:set magic
 /\v(a)(b)\2\1\1/e
 x/\V[ab]\(\[xy]\)\1
-x:?^1?,$w! test.out
+x:$
+:set undolevels=100
+dv?bar?
+Yup:"
+:?^1?,$w! test.out
 :qa!
 ENDTEST
 
 6 x ^aa$ x
 7 (a)(b) abbaa
 8 axx [ab]xx
+9 foobar
+

src/testdir/test43.ok

 6 x aa$ x
 7 (a)(b) abba
 8 axx ab]xx
+9 foobar
+9 foo
+
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    395,
+/**/
     394,
 /**/
     393,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.