mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
lint
This commit is contained in:
@@ -4074,65 +4074,66 @@ void ex_global(exarg_T *eap)
|
|||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Execute `cmd` on lines marked with ml_setmarked().
|
||||||
* Execute "cmd" on lines marked with ml_setmarked().
|
|
||||||
*/
|
|
||||||
void global_exe(char_u *cmd)
|
void global_exe(char_u *cmd)
|
||||||
{
|
{
|
||||||
linenr_T old_lcount; /* b_ml.ml_line_count before the command */
|
linenr_T old_lcount; // b_ml.ml_line_count before the command
|
||||||
buf_T *old_buf = curbuf; /* remember what buffer we started in */
|
buf_T *old_buf = curbuf; // remember what buffer we started in
|
||||||
linenr_T lnum; /* line number according to old situation */
|
linenr_T lnum; // line number according to old situation
|
||||||
int save_mapped_ctrl_c = mapped_ctrl_c;
|
int save_mapped_ctrl_c = mapped_ctrl_c;
|
||||||
|
|
||||||
/*
|
// Set current position only once for a global command.
|
||||||
* Set current position only once for a global command.
|
// If global_busy is set, setpcmark() will not do anything.
|
||||||
* If global_busy is set, setpcmark() will not do anything.
|
// If there is an error, global_busy will be incremented.
|
||||||
* If there is an error, global_busy will be incremented.
|
|
||||||
*/
|
|
||||||
setpcmark();
|
setpcmark();
|
||||||
|
|
||||||
/* When the command writes a message, don't overwrite the command. */
|
// When the command writes a message, don't overwrite the command.
|
||||||
msg_didout = TRUE;
|
msg_didout = true;
|
||||||
// Disable CTRL-C mapping, let it interrupt (potentially long output).
|
// Disable CTRL-C mapping, let it interrupt (potentially long output).
|
||||||
mapped_ctrl_c = 0;
|
mapped_ctrl_c = 0;
|
||||||
|
|
||||||
sub_nsubs = 0;
|
sub_nsubs = 0;
|
||||||
sub_nlines = 0;
|
sub_nlines = 0;
|
||||||
global_need_beginline = FALSE;
|
global_need_beginline = false;
|
||||||
global_busy = 1;
|
global_busy = 1;
|
||||||
old_lcount = curbuf->b_ml.ml_line_count;
|
old_lcount = curbuf->b_ml.ml_line_count;
|
||||||
|
|
||||||
while (!got_int && (lnum = ml_firstmarked()) != 0 && global_busy == 1) {
|
while (!got_int && (lnum = ml_firstmarked()) != 0 && global_busy == 1) {
|
||||||
curwin->w_cursor.lnum = lnum;
|
curwin->w_cursor.lnum = lnum;
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
if (*cmd == NUL || *cmd == '\n')
|
if (*cmd == NUL || *cmd == '\n') {
|
||||||
do_cmdline((char_u *)"p", NULL, NULL, DOCMD_NOWAIT);
|
do_cmdline((char_u *)"p", NULL, NULL, DOCMD_NOWAIT);
|
||||||
else
|
} else {
|
||||||
do_cmdline(cmd, NULL, NULL, DOCMD_NOWAIT);
|
do_cmdline(cmd, NULL, NULL, DOCMD_NOWAIT);
|
||||||
|
}
|
||||||
os_breakcheck();
|
os_breakcheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapped_ctrl_c = save_mapped_ctrl_c;
|
mapped_ctrl_c = save_mapped_ctrl_c;
|
||||||
global_busy = 0;
|
global_busy = 0;
|
||||||
if (global_need_beginline)
|
if (global_need_beginline) {
|
||||||
beginline(BL_WHITE | BL_FIX);
|
beginline(BL_WHITE | BL_FIX);
|
||||||
else
|
} else {
|
||||||
check_cursor(); /* cursor may be beyond the end of the line */
|
check_cursor(); // cursor may be beyond the end of the line
|
||||||
|
}
|
||||||
|
|
||||||
/* the cursor may not have moved in the text but a change in a previous
|
// the cursor may not have moved in the text but a change in a previous
|
||||||
* line may move it on the screen */
|
// line may move it on the screen
|
||||||
changed_line_abv_curs();
|
changed_line_abv_curs();
|
||||||
|
|
||||||
/* If it looks like no message was written, allow overwriting the
|
// If it looks like no message was written, allow overwriting the
|
||||||
* command with the report for number of changes. */
|
// command with the report for number of changes.
|
||||||
if (msg_col == 0 && msg_scrolled == 0)
|
if (msg_col == 0 && msg_scrolled == 0) {
|
||||||
msg_didout = FALSE;
|
msg_didout = false;
|
||||||
|
}
|
||||||
|
|
||||||
/* If substitutes done, report number of substitutes, otherwise report
|
// If substitutes done, report number of substitutes, otherwise report
|
||||||
* number of extra or deleted lines.
|
// number of extra or deleted lines.
|
||||||
* Don't report extra or deleted lines in the edge case where the buffer
|
// Don't report extra or deleted lines in the edge case where the buffer
|
||||||
* we are in after execution is different from the buffer we started in. */
|
// we are in after execution is different from the buffer we started in.
|
||||||
if (!do_sub_msg(false) && curbuf == old_buf)
|
if (!do_sub_msg(false) && curbuf == old_buf) {
|
||||||
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
|
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(EXITFREE)
|
#if defined(EXITFREE)
|
||||||
|
Reference in New Issue
Block a user