diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-02-22 17:38:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-02-22 17:38:00 +0100 |
commit | 5f1e3e4473ed4364abc9f45f61e1530f70c82194 (patch) | |
tree | 1a430c162b83cd29a45201ce377388d325fce8ff | |
parent | db7207e6e51cf6677545e2f8e0aca427b3cf1956 (diff) | |
download | vim-git-7.3.452.tar.gz |
updated for version 7.3.452v7.3.452
Problem: Undo broken when pasting close to the last line. (Andrey Radev)
Solution: Use a flag to remember if the deleted included the last line.
(Christian Brabandt)
-rw-r--r-- | src/ops.c | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 5 insertions, 1 deletions
@@ -1943,12 +1943,14 @@ op_delete(oap) else /* delete characters between lines */ { pos_T curpos; + int delete_last_line; /* save deleted and changed lines for undo */ if (u_save((linenr_T)(curwin->w_cursor.lnum - 1), (linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL) return FAIL; + delete_last_line = (oap->end.lnum == curbuf->b_ml.ml_line_count); truncate_line(TRUE); /* delete from cursor to end of line */ curpos = curwin->w_cursor; /* remember curwin->w_cursor */ @@ -1956,7 +1958,7 @@ op_delete(oap) del_lines((long)(oap->line_count - 2), FALSE); n = (oap->end.col + 1 - !oap->inclusive); - if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count + if (oap->inclusive && delete_last_line && n > (int)STRLEN(ml_get(oap->end.lnum))) { /* Special case: gH<Del> deletes the last line. */ diff --git a/src/version.c b/src/version.c index f9da5db7a..0b6c063b3 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 */ /**/ + 452, +/**/ 451, /**/ 450, |