diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-10-06 17:46:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-10-06 17:46:56 +0200 |
commit | 2c019c8696ca56d1a9d1bb10fd1411bad14df0c6 (patch) | |
tree | 43f484452ad6a18059a901cbf076fffd9b53e7bf /src/ops.c | |
parent | a951e35478fd78d6d3cd970842502fb76c377df9 (diff) | |
download | vim-git-2c019c8696ca56d1a9d1bb10fd1411bad14df0c6.tar.gz |
updated for version 7.4.052v7.4.052
Problem: With 'fo' set to "a2" inserting a space in the first column may
cause the cursor to jump to the previous line.
Solution: Handle the case when there is no comment leader properly. (Tor
Perkins) Also fix that cursor is in the wrong place when spaces
get replaced with a Tab.
Diffstat (limited to 'src/ops.c')
-rw-r--r-- | src/ops.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -4989,7 +4989,7 @@ format_lines(line_count, avoid_fex) /* * When still in same paragraph, join the lines together. But - * first delete the comment leader from the second line. + * first delete the leader from the second line. */ if (!is_end_par) { @@ -4999,11 +4999,25 @@ format_lines(line_count, avoid_fex) if (line_count < 0 && u_save_cursor() == FAIL) break; #ifdef FEAT_COMMENTS - (void)del_bytes((long)next_leader_len, FALSE, FALSE); if (next_leader_len > 0) + { + (void)del_bytes((long)next_leader_len, FALSE, FALSE); mark_col_adjust(curwin->w_cursor.lnum, (colnr_T)0, 0L, (long)-next_leader_len); + } else #endif + if (second_indent > 0) /* the "leader" for FO_Q_SECOND */ + { + char_u *p = ml_get_curline(); + int indent = skipwhite(p) - p; + + if (indent > 0) + { + (void)del_bytes(indent, FALSE, FALSE); + mark_col_adjust(curwin->w_cursor.lnum, + (colnr_T)0, 0L, (long)-indent); + } + } curwin->w_cursor.lnum--; if (do_join(2, TRUE, FALSE, FALSE) == FAIL) { |