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)
/* 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)
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
+
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,
/**/