| To: vim-dev@vim.org |
| Subject: Patch 7.3.020 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.3.020 |
| Problem: Cursor position wrong when joining multiple lines and |
| 'formatoptions' contains "a". (Moshe Kamensky) |
| Solution: Adjust cursor position for skipped indent. (Carlo Teubner) |
| Files: src/ops.c, src/testdir/test68.in, src/testdir/test68.ok |
| |
| |
| |
| |
| |
| *** 4153,4161 **** |
| int save_undo; |
| { |
| char_u *curr = NULL; |
| char_u *cend; |
| char_u *newp; |
| ! char_u *spaces; /* number of spaces inserte before a line */ |
| int endcurr1 = NUL; |
| int endcurr2 = NUL; |
| int currsize = 0; /* size of the current line */ |
| --- 4153,4162 ---- |
| int save_undo; |
| { |
| char_u *curr = NULL; |
| + char_u *curr_start = NULL; |
| char_u *cend; |
| char_u *newp; |
| ! char_u *spaces; /* number of spaces inserted before a line */ |
| int endcurr1 = NUL; |
| int endcurr2 = NUL; |
| int currsize = 0; /* size of the current line */ |
| |
| *** 4181,4187 **** |
| */ |
| for (t = 0; t < count; ++t) |
| { |
| ! curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); |
| if (insert_space && t > 0) |
| { |
| curr = skipwhite(curr); |
| --- 4182,4188 ---- |
| */ |
| for (t = 0; t < count; ++t) |
| { |
| ! curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); |
| if (insert_space && t > 0) |
| { |
| curr = skipwhite(curr); |
| |
| *** 4265,4274 **** |
| copy_spaces(cend, (size_t)(spaces[t])); |
| } |
| mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t, |
| ! (long)(cend - newp + spaces[t])); |
| if (t == 0) |
| break; |
| ! curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1)); |
| if (insert_space && t > 1) |
| curr = skipwhite(curr); |
| currsize = (int)STRLEN(curr); |
| --- 4266,4275 ---- |
| copy_spaces(cend, (size_t)(spaces[t])); |
| } |
| mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t, |
| ! (long)(cend - newp + spaces[t] - (curr - curr_start))); |
| if (t == 0) |
| break; |
| ! curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1)); |
| if (insert_space && t > 1) |
| curr = skipwhite(curr); |
| currsize = (int)STRLEN(curr); |
| |
| |
| |
| *** 51,56 **** |
| --- 51,67 ---- |
| } |
| |
| STARTTEST |
| + /^{/+2 |
| + :set tw& fo=a |
| + I^^ |
| + ENDTEST |
| + |
| + { |
| + 1aa |
| + 2bb |
| + } |
| + |
| + STARTTEST |
| :g/^STARTTEST/.,/^ENDTEST/d |
| :1;/^Results/,$wq! test.out |
| ENDTEST |
| |
| |
| |
| *** 33,35 **** |
| --- 33,38 ---- |
| #a b |
| } |
| |
| + |
| + { 1aa ^^2bb } |
| + |
| |
| |
| |
| *** 716,717 **** |
| --- 716,719 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 20, |
| /**/ |
| |
| -- |
| Did you hear about the new 3 million dollar West Virginia State Lottery? |
| The winner gets 3 dollars a year for a million years. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ download, build and distribute -- http://www.A-A-P.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |