mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 11:26:37 +00:00
vim-patch:7.4.267
Problem: The '[ mark is in the wrong position after "gq". (Ingo Karkat) Solution: Add the setmark argument to do_join(). (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=75f222d67cea335efbe0274de6340dba174c1e7e
This commit is contained in:

committed by
Justin M. Keyes

parent
1b43e5c47e
commit
753401ab4c
@@ -1623,8 +1623,9 @@ int op_delete(oparg_T *oap)
|
||||
);
|
||||
curwin->w_cursor = curpos; /* restore curwin->w_cursor */
|
||||
}
|
||||
if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
|
||||
(void)do_join(2, FALSE, FALSE, FALSE);
|
||||
if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
|
||||
do_join(2, FALSE, FALSE, FALSE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3381,15 +3382,19 @@ static char_u *skip_comment(char_u *line, int process, int include_space, int *i
|
||||
return line;
|
||||
}
|
||||
|
||||
/*
|
||||
* Join 'count' lines (minimal 2) at cursor position.
|
||||
* When "save_undo" is TRUE save lines for undo first.
|
||||
* Set "use_formatoptions" to FALSE when e.g. processing
|
||||
* backspace and comment leaders should not be removed.
|
||||
*
|
||||
* return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int do_join(long count, int insert_space, int save_undo, int use_formatoptions)
|
||||
// Join 'count' lines (minimal 2) at cursor position.
|
||||
// When "save_undo" is TRUE save lines for undo first.
|
||||
// Set "use_formatoptions" to FALSE when e.g. processing backspace and comment
|
||||
// leaders should not be removed.
|
||||
// When setmark is true, sets the '[ and '] mark, else, the caller is expected
|
||||
// to set those marks.
|
||||
//
|
||||
// return FAIL for failure, OK otherwise
|
||||
int do_join(long count,
|
||||
int insert_space,
|
||||
int save_undo,
|
||||
int use_formatoptions,
|
||||
bool setmark)
|
||||
{
|
||||
char_u *curr = NULL;
|
||||
char_u *curr_start = NULL;
|
||||
@@ -3427,7 +3432,7 @@ int do_join(long count, int insert_space, int save_undo, int use_formatoptions)
|
||||
*/
|
||||
for (t = 0; t < count; ++t) {
|
||||
curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
|
||||
if (t == 0) {
|
||||
if (t == 0 && setmark) {
|
||||
// Set the '[ mark.
|
||||
curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
|
||||
curwin->w_buffer->b_op_start.col = (colnr_T)STRLEN(curr);
|
||||
@@ -3527,9 +3532,11 @@ int do_join(long count, int insert_space, int save_undo, int use_formatoptions)
|
||||
}
|
||||
ml_replace(curwin->w_cursor.lnum, newp, FALSE);
|
||||
|
||||
// Set the '] mark.
|
||||
curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
|
||||
curwin->w_buffer->b_op_end.col = (colnr_T)STRLEN(newp);
|
||||
if (setmark) {
|
||||
// Set the '] mark.
|
||||
curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
|
||||
curwin->w_buffer->b_op_end.col = (colnr_T)STRLEN(newp);
|
||||
}
|
||||
|
||||
/* Only report the change in the first line here, del_lines() will report
|
||||
* the deleted line. */
|
||||
@@ -3953,7 +3960,7 @@ format_lines (
|
||||
}
|
||||
}
|
||||
curwin->w_cursor.lnum--;
|
||||
if (do_join(2, TRUE, FALSE, FALSE) == FAIL) {
|
||||
if (do_join(2, TRUE, FALSE, FALSE, false) == FAIL) {
|
||||
beep_flush();
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user