4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Cursor position wrong when joining multiple lines and
12 'formatoptions' contains "a". (Moshe Kamensky)
13 Solution: Adjust cursor position for skipped indent. (Carlo Teubner)
14 Files: src/ops.c, src/testdir/test68.in, src/testdir/test68.ok
17 *** ../vim-7.3.019/src/ops.c 2010-08-15 21:57:28.000000000 +0200
18 --- src/ops.c 2010-10-09 17:00:35.000000000 +0200
26 ! char_u *spaces; /* number of spaces inserte before a line */
29 int currsize = 0; /* size of the current line */
34 + char_u *curr_start = NULL;
37 ! char_u *spaces; /* number of spaces inserted before a line */
40 int currsize = 0; /* size of the current line */
44 for (t = 0; t < count; ++t)
46 ! curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
47 if (insert_space && t > 0)
49 curr = skipwhite(curr);
52 for (t = 0; t < count; ++t)
54 ! curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
55 if (insert_space && t > 0)
57 curr = skipwhite(curr);
60 copy_spaces(cend, (size_t)(spaces[t]));
62 mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t,
63 ! (long)(cend - newp + spaces[t]));
66 ! curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
67 if (insert_space && t > 1)
68 curr = skipwhite(curr);
69 currsize = (int)STRLEN(curr);
71 copy_spaces(cend, (size_t)(spaces[t]));
73 mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t,
74 ! (long)(cend - newp + spaces[t] - (curr - curr_start)));
77 ! curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
78 if (insert_space && t > 1)
79 curr = skipwhite(curr);
80 currsize = (int)STRLEN(curr);
81 *** ../vim-7.3.019/src/testdir/test68.in 2010-08-15 21:57:29.000000000 +0200
82 --- src/testdir/test68.in 2010-10-09 16:53:02.000000000 +0200
100 :g/^STARTTEST/.,/^ENDTEST/d
101 :1;/^Results/,$wq! test.out
103 *** ../vim-7.3.019/src/testdir/test68.ok 2010-08-15 21:57:29.000000000 +0200
104 --- src/testdir/test68.ok 2010-10-09 16:53:02.000000000 +0200
114 *** ../vim-7.3.019/src/version.c 2010-09-30 21:03:13.000000000 +0200
115 --- src/version.c 2010-10-09 17:05:31.000000000 +0200
119 { /* Add new patch number below this line */
125 Did you hear about the new 3 million dollar West Virginia State Lottery?
126 The winner gets 3 dollars a year for a million years.
128 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
129 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
130 \\\ download, build and distribute -- http://www.A-A-P.org ///
131 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///