0
0
mirror of https://github.com/vim/vim.git synced 2025-10-11 06:34:16 -04:00

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)
This commit is contained in:
Bram Moolenaar
2012-01-10 13:44:27 +01:00
parent 738f8fc8ed
commit 66accae339
4 changed files with 15 additions and 4 deletions

View File

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

View File

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

View File

@@ -6,3 +6,6 @@
6 x aa$ x 6 x aa$ x
7 (a)(b) abba 7 (a)(b) abba
8 axx ab]xx 8 axx ab]xx
9 foobar
9 foo

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
395,
/**/ /**/
394, 394,
/**/ /**/