diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-10-09 17:23:31 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-10-09 17:23:31 +0200 |
commit | 341ad7a6994f30f420411b01f3020a999a663f5f (patch) | |
tree | 162dc7b8e100a3747145003ef0bbf3b7770e0cab /src/ops.c | |
parent | 4a74803ef837eeb4d4fc799ac9a26fc93e584111 (diff) | |
download | vim-git-341ad7a6994f30f420411b01f3020a999a663f5f.tar.gz |
updated for version 7.3.020v7.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)
Diffstat (limited to 'src/ops.c')
-rw-r--r-- | src/ops.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -4153,9 +4153,10 @@ do_join(count, insert_space, save_undo) int save_undo; { char_u *curr = NULL; + char_u *curr_start = NULL; char_u *cend; char_u *newp; - char_u *spaces; /* number of spaces inserte before a line */ + 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,7 +4182,7 @@ do_join(count, insert_space, save_undo) */ for (t = 0; t < count; ++t) { - curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); + curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); if (insert_space && t > 0) { curr = skipwhite(curr); @@ -4265,10 +4266,10 @@ do_join(count, insert_space, save_undo) 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])); + (long)(cend - newp + spaces[t] - (curr - curr_start))); if (t == 0) break; - curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1)); + 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); |