1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Undo broken when pasting close to the last line. (Andrey Radev)
12 Solution: Use a flag to remember if the deleted included the last line.
17 *** ../vim-7.3.451/src/ops.c 2012-01-10 13:46:18.000000000 +0100
18 --- src/ops.c 2012-02-22 17:32:40.000000000 +0100
22 else /* delete characters between lines */
25 + int delete_last_line;
27 /* save deleted and changed lines for undo */
28 if (u_save((linenr_T)(curwin->w_cursor.lnum - 1),
29 (linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL)
32 + delete_last_line = (oap->end.lnum == curbuf->b_ml.ml_line_count);
33 truncate_line(TRUE); /* delete from cursor to end of line */
35 curpos = curwin->w_cursor; /* remember curwin->w_cursor */
38 del_lines((long)(oap->line_count - 2), FALSE);
40 n = (oap->end.col + 1 - !oap->inclusive);
41 ! if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count
42 && n > (int)STRLEN(ml_get(oap->end.lnum)))
44 /* Special case: gH<Del> deletes the last line. */
46 del_lines((long)(oap->line_count - 2), FALSE);
48 n = (oap->end.col + 1 - !oap->inclusive);
49 ! if (oap->inclusive && delete_last_line
50 && n > (int)STRLEN(ml_get(oap->end.lnum)))
52 /* Special case: gH<Del> deletes the last line. */
53 *** ../vim-7.3.451/src/version.c 2012-02-22 16:01:53.000000000 +0100
54 --- src/version.c 2012-02-22 17:37:18.000000000 +0100
58 { /* Add new patch number below this line */
64 From "know your smileys":
67 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
68 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
69 \\\ an exciting new programming language -- http://www.Zimbu.org ///
70 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///