summaryrefslogtreecommitdiff
path: root/src/ops.c
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
commit66accae33961b02cab7c4ad6cdb1e0bc16da8cb8 (patch)
tree6a29aebc96b7ef744067903766b0d8f3ec69b2a3 /src/ops.c
parent738f8fc8edf7a87824bba8650c04ba6197fea25f (diff)
downloadvim-git-66accae33961b02cab7c4ad6cdb1e0bc16da8cb8.tar.gz
updated for version 7.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)
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ops.c b/src/ops.c
index 656285a50..f8341a81a 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)