]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.395 v7.3.395
authorBram Moolenaar <Bram@vim.org>
Tue, 10 Jan 2012 12:44:27 +0000 (13:44 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 10 Jan 2012 12:44:27 +0000 (13:44 +0100)
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)

src/ops.c
src/testdir/test43.in
src/testdir/test43.ok
src/version.c

index 656285a50fabe0a87021704d81dc208716f7e948..f8341a81ab1807aab25b37a81b91111d86c34176 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -1961,8 +1961,8 @@ op_delete(oap)
                /* 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
            {
@@ -4434,7 +4434,7 @@ same_leader(lnum, leader1_len, leader1_flags, leader2_len, leader2_flags)
 #endif
 
 /*
- * implementation of the format operator 'gq'
+ * Implementation of the format operator 'gq'.
  */
     void
 op_format(oap, keep_cursor)
index 26f0e0c9a93f64e73585db58ee9f7e26be84c0e1..49a97d939dc3d2198c420b31be37d05caff14265 100644 (file)
@@ -13,7 +13,11 @@ x/\V^aa$
 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
 
@@ -25,3 +29,5 @@ ENDTEST
 6 x ^aa$ x
 7 (a)(b) abbaa
 8 axx [ab]xx
+9 foobar
+
index 425316b68d310ca2131e94ed0e2aff21bc9d2b5d..0b37a6a61e6cecd0d355e156de5fea02740184ba 100644 (file)
@@ -6,3 +6,6 @@
 6 x aa$ x
 7 (a)(b) abba
 8 axx ab]xx
+9 foobar
+9 foo
+
index b7fa49ceb10cf177bac3b18419b3a9cf80c39ba0..c33a6f38dfa25f5e7d27ed415423db0c5151d699 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    395,
 /**/
     394,
 /**/