summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2012-01-10 13:44:27 +0100
committerBram Moolenaar <bram@vim.org>2012-01-10 13:44:27 +0100
commitc2a9147fa7c943bf43292324d46a902eb755f850 (patch)
tree2f9e487d23f6b920139bd0a846bc22dbdd61f990
parentcfc3f85a54bf4ac5a13df32bfed652235dd5ae44 (diff)
downloadvim-c2a9147fa7c943bf43292324d46a902eb755f850.tar.gz
updated for version 7.3.395v7.3.395v7-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)
-rw-r--r--src/ops.c6
-rw-r--r--src/testdir/test43.in8
-rw-r--r--src/testdir/test43.ok3
-rw-r--r--src/version.c2
4 files changed, 15 insertions, 4 deletions
diff --git a/src/ops.c b/src/ops.c
index 656285a5..f8341a81 100644
--- 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)
diff --git a/src/testdir/test43.in b/src/testdir/test43.in
index 26f0e0c9..49a97d93 100644
--- a/src/testdir/test43.in
+++ b/src/testdir/test43.in
@@ -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
+
diff --git a/src/testdir/test43.ok b/src/testdir/test43.ok
index 425316b6..0b37a6a6 100644
--- a/src/testdir/test43.ok
+++ b/src/testdir/test43.ok
@@ -6,3 +6,6 @@
6 x aa$ x
7 (a)(b) abba
8 axx ab]xx
+9 foobar
+9 foo
+
diff --git a/src/version.c b/src/version.c
index b7fa49ce..c33a6f38 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 395,
+/**/
394,
/**/
393,