mirror of
https://github.com/neovim/neovim.git
synced 2025-09-21 02:38:19 +00:00
vim-patch:8.2.1898: command modifier parsing always uses global cmdmod
Problem: Command modifier parsing always uses global cmdmod.
Solution: Pass in cmdmod_T to use. Rename struct fields consistently.
e100440158
This commit is contained in:
@@ -1411,7 +1411,6 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **er
|
||||
char *cmd;
|
||||
char *p;
|
||||
char *after_modifier = NULL;
|
||||
cmdmod_T save_cmdmod = cmdmod;
|
||||
|
||||
// Initialize cmdinfo
|
||||
memset(cmdinfo, 0, sizeof(*cmdinfo));
|
||||
@@ -1426,18 +1425,16 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **er
|
||||
eap->cookie = NULL;
|
||||
|
||||
// Parse command modifiers
|
||||
if (parse_command_modifiers(eap, errormsg, false) == FAIL) {
|
||||
if (parse_command_modifiers(eap, errormsg, &cmdinfo->cmdmod, false) == FAIL) {
|
||||
return false;
|
||||
}
|
||||
after_modifier = eap->cmd;
|
||||
|
||||
if (cmdmod.cmod_verbose != 0) {
|
||||
cmdinfo->verbose = cmdmod.cmod_verbose < 0 ? 0 : cmdmod.cmod_verbose;
|
||||
if (cmdinfo->cmdmod.cmod_verbose != 0) {
|
||||
cmdinfo->verbose = cmdinfo->cmdmod.cmod_verbose < 0 ? 0 : cmdinfo->cmdmod.cmod_verbose;
|
||||
} else {
|
||||
cmdinfo->verbose = -1;
|
||||
}
|
||||
cmdinfo->cmdmod = cmdmod;
|
||||
cmdmod = save_cmdmod;
|
||||
|
||||
// Save location after command modifiers
|
||||
cmd = eap->cmd;
|
||||
@@ -1673,7 +1670,7 @@ end:
|
||||
emsg(errormsg);
|
||||
}
|
||||
// Undo command modifiers
|
||||
undo_cmdmod(msg_scroll);
|
||||
undo_cmdmod(&cmdmod);
|
||||
cmdmod = save_cmdmod;
|
||||
return retv;
|
||||
#undef ERROR
|
||||
@@ -1704,7 +1701,6 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
|
||||
char *errormsg = NULL; // error message
|
||||
char *after_modifier = NULL;
|
||||
exarg_T ea;
|
||||
const int save_msg_scroll = msg_scroll;
|
||||
cmdmod_T save_cmdmod;
|
||||
const int save_reg_executing = reg_executing;
|
||||
const bool save_pending_end_reg_executing = pending_end_reg_executing;
|
||||
@@ -1746,7 +1742,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
|
||||
ea.cookie = cookie;
|
||||
ea.cstack = cstack;
|
||||
|
||||
if (parse_command_modifiers(&ea, &errormsg, false) == FAIL) {
|
||||
if (parse_command_modifiers(&ea, &errormsg, &cmdmod, false) == FAIL) {
|
||||
goto doend;
|
||||
}
|
||||
apply_cmdmod(&cmdmod);
|
||||
@@ -2361,7 +2357,7 @@ doend:
|
||||
(ea.cmdidx != CMD_SIZE
|
||||
&& !IS_USER_CMDIDX(ea.cmdidx)) ? cmdnames[(int)ea.cmdidx].cmd_name : NULL);
|
||||
|
||||
undo_cmdmod(save_msg_scroll);
|
||||
undo_cmdmod(&cmdmod);
|
||||
cmdmod = save_cmdmod;
|
||||
reg_executing = save_reg_executing;
|
||||
pending_end_reg_executing = save_pending_end_reg_executing;
|
||||
@@ -2389,25 +2385,25 @@ char *ex_errmsg(const char *const msg, const char *const arg)
|
||||
|
||||
/// Parse and skip over command modifiers:
|
||||
/// - update eap->cmd
|
||||
/// - store flags in "cmdmod".
|
||||
/// - store flags in "cmod".
|
||||
/// - Set ex_pressedreturn for an empty command line.
|
||||
/// - set msg_silent for ":silent"
|
||||
/// - set 'eventignore' to "all" for ":noautocmd"
|
||||
///
|
||||
/// @param skip_only if true, the global variables are not changed, except for
|
||||
/// "cmdmod".
|
||||
/// @param skip_only if false, undo_cmdmod() must be called later to free
|
||||
/// any cmod_filter_regmatch.regprog.
|
||||
/// @param[out] errormsg potential error message.
|
||||
///
|
||||
/// Call apply_cmdmod() to get the side effects of the modifiers:
|
||||
/// - Increment "sandbox" for ":sandbox"
|
||||
/// - set p_verbose for ":verbose"
|
||||
/// - set msg_silent for ":silent"
|
||||
/// - set 'eventignore' to "all" for ":noautocmd"
|
||||
///
|
||||
/// @return FAIL when the command is not to be executed.
|
||||
int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
int parse_command_modifiers(exarg_T *eap, char **errormsg, cmdmod_T *cmod, bool skip_only)
|
||||
{
|
||||
char *p;
|
||||
|
||||
memset(&cmdmod, 0, sizeof(cmdmod));
|
||||
memset(cmod, 0, sizeof(*cmod));
|
||||
|
||||
// Repeat until no more command modifiers are found.
|
||||
for (;;) {
|
||||
@@ -2445,48 +2441,48 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
if (!checkforcmd(&eap->cmd, "aboveleft", 3)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.split |= WSP_ABOVE;
|
||||
cmod->cmod_split |= WSP_ABOVE;
|
||||
continue;
|
||||
|
||||
case 'b':
|
||||
if (checkforcmd(&eap->cmd, "belowright", 3)) {
|
||||
cmdmod.split |= WSP_BELOW;
|
||||
cmod->cmod_split |= WSP_BELOW;
|
||||
continue;
|
||||
}
|
||||
if (checkforcmd(&eap->cmd, "browse", 3)) {
|
||||
cmdmod.browse = true;
|
||||
cmod->cmod_flags |= CMOD_BROWSE;
|
||||
continue;
|
||||
}
|
||||
if (!checkforcmd(&eap->cmd, "botright", 2)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.split |= WSP_BOT;
|
||||
cmod->cmod_split |= WSP_BOT;
|
||||
continue;
|
||||
|
||||
case 'c':
|
||||
if (!checkforcmd(&eap->cmd, "confirm", 4)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.confirm = true;
|
||||
cmod->cmod_flags |= CMOD_CONFIRM;
|
||||
continue;
|
||||
|
||||
case 'k':
|
||||
if (checkforcmd(&eap->cmd, "keepmarks", 3)) {
|
||||
cmdmod.keepmarks = true;
|
||||
cmod->cmod_flags |= CMOD_KEEPMARKS;
|
||||
continue;
|
||||
}
|
||||
if (checkforcmd(&eap->cmd, "keepalt", 5)) {
|
||||
cmdmod.keepalt = true;
|
||||
cmod->cmod_flags |= CMOD_KEEPALT;
|
||||
continue;
|
||||
}
|
||||
if (checkforcmd(&eap->cmd, "keeppatterns", 5)) {
|
||||
cmdmod.keeppatterns = true;
|
||||
cmod->cmod_flags |= CMOD_KEEPPATTERNS;
|
||||
continue;
|
||||
}
|
||||
if (!checkforcmd(&eap->cmd, "keepjumps", 5)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.keepjumps = true;
|
||||
cmod->cmod_flags |= CMOD_KEEPJUMPS;
|
||||
continue;
|
||||
|
||||
case 'f': { // only accept ":filter {pat} cmd"
|
||||
@@ -2496,7 +2492,7 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
break;
|
||||
}
|
||||
if (*p == '!') {
|
||||
cmdmod.filter_force = true;
|
||||
cmod->cmod_filter_force = true;
|
||||
p = skipwhite(p + 1);
|
||||
if (*p == NUL || ends_excmd(*p)) {
|
||||
break;
|
||||
@@ -2512,8 +2508,8 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
break;
|
||||
}
|
||||
if (!skip_only) {
|
||||
cmdmod.filter_regmatch.regprog = vim_regcomp(reg_pat, RE_MAGIC);
|
||||
if (cmdmod.filter_regmatch.regprog == NULL) {
|
||||
cmod->cmod_filter_regmatch.regprog = vim_regcomp(reg_pat, RE_MAGIC);
|
||||
if (cmod->cmod_filter_regmatch.regprog == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2528,52 +2524,52 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
break;
|
||||
}
|
||||
eap->cmd = p;
|
||||
cmdmod.hide = true;
|
||||
cmod->cmod_flags |= CMOD_HIDE;
|
||||
continue;
|
||||
|
||||
case 'l':
|
||||
if (checkforcmd(&eap->cmd, "lockmarks", 3)) {
|
||||
cmdmod.lockmarks = true;
|
||||
cmod->cmod_flags |= CMOD_LOCKMARKS;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!checkforcmd(&eap->cmd, "leftabove", 5)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.split |= WSP_ABOVE;
|
||||
cmod->cmod_split |= WSP_ABOVE;
|
||||
continue;
|
||||
|
||||
case 'n':
|
||||
if (checkforcmd(&eap->cmd, "noautocmd", 3)) {
|
||||
cmdmod.cmod_flags |= CMOD_NOAUTOCMD;
|
||||
cmod->cmod_flags |= CMOD_NOAUTOCMD;
|
||||
continue;
|
||||
}
|
||||
if (!checkforcmd(&eap->cmd, "noswapfile", 3)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.noswapfile = true;
|
||||
cmod->cmod_flags |= CMOD_NOSWAPFILE;
|
||||
continue;
|
||||
|
||||
case 'r':
|
||||
if (!checkforcmd(&eap->cmd, "rightbelow", 6)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.split |= WSP_BELOW;
|
||||
cmod->cmod_split |= WSP_BELOW;
|
||||
continue;
|
||||
|
||||
case 's':
|
||||
if (checkforcmd(&eap->cmd, "sandbox", 3)) {
|
||||
cmdmod.cmod_flags |= CMOD_SANDBOX;
|
||||
cmod->cmod_flags |= CMOD_SANDBOX;
|
||||
continue;
|
||||
}
|
||||
if (!checkforcmd(&eap->cmd, "silent", 3)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.cmod_flags |= CMOD_SILENT;
|
||||
cmod->cmod_flags |= CMOD_SILENT;
|
||||
if (*eap->cmd == '!' && !ascii_iswhite(eap->cmd[-1])) {
|
||||
// ":silent!", but not "silent !cmd"
|
||||
eap->cmd = skipwhite(eap->cmd + 1);
|
||||
cmdmod.cmod_flags |= CMOD_ERRSILENT;
|
||||
cmod->cmod_flags |= CMOD_ERRSILENT;
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -2584,13 +2580,13 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
false, 1);
|
||||
|
||||
if (tabnr == MAXLNUM) {
|
||||
cmdmod.tab = tabpage_index(curtab) + 1;
|
||||
cmod->cmod_tab = tabpage_index(curtab) + 1;
|
||||
} else {
|
||||
if (tabnr < 0 || tabnr > LAST_TAB_NR) {
|
||||
*errormsg = _(e_invrange);
|
||||
return false;
|
||||
}
|
||||
cmdmod.tab = tabnr + 1;
|
||||
cmod->cmod_tab = tabnr + 1;
|
||||
}
|
||||
}
|
||||
eap->cmd = p;
|
||||
@@ -2599,31 +2595,31 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
|
||||
if (!checkforcmd(&eap->cmd, "topleft", 2)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.split |= WSP_TOP;
|
||||
cmod->cmod_split |= WSP_TOP;
|
||||
continue;
|
||||
|
||||
case 'u':
|
||||
if (!checkforcmd(&eap->cmd, "unsilent", 3)) {
|
||||
break;
|
||||
}
|
||||
cmdmod.cmod_flags |= CMOD_UNSILENT;
|
||||
cmod->cmod_flags |= CMOD_UNSILENT;
|
||||
continue;
|
||||
|
||||
case 'v':
|
||||
if (checkforcmd(&eap->cmd, "vertical", 4)) {
|
||||
cmdmod.split |= WSP_VERT;
|
||||
cmod->cmod_split |= WSP_VERT;
|
||||
continue;
|
||||
}
|
||||
if (!checkforcmd(&p, "verbose", 4)) {
|
||||
break;
|
||||
}
|
||||
if (ascii_isdigit(*eap->cmd)) {
|
||||
cmdmod.cmod_verbose = atoi((char *)eap->cmd);
|
||||
if (cmdmod.cmod_verbose == 0) {
|
||||
cmdmod.cmod_verbose = -1;
|
||||
cmod->cmod_verbose = atoi((char *)eap->cmd);
|
||||
if (cmod->cmod_verbose == 0) {
|
||||
cmod->cmod_verbose = -1;
|
||||
}
|
||||
} else {
|
||||
cmdmod.cmod_verbose = 1;
|
||||
cmod->cmod_verbose = 1;
|
||||
}
|
||||
eap->cmd = p;
|
||||
continue;
|
||||
@@ -2652,6 +2648,7 @@ static void apply_cmdmod(cmdmod_T *cmod)
|
||||
if ((cmod->cmod_flags & (CMOD_SILENT | CMOD_UNSILENT))
|
||||
&& cmod->cmod_save_msg_silent == 0) {
|
||||
cmod->cmod_save_msg_silent = msg_silent + 1;
|
||||
cmod->cmod_save_msg_scroll = msg_scroll;
|
||||
}
|
||||
if (cmod->cmod_flags & CMOD_SILENT) {
|
||||
msg_silent++;
|
||||
@@ -2665,50 +2662,50 @@ static void apply_cmdmod(cmdmod_T *cmod)
|
||||
cmod->cmod_did_esilent++;
|
||||
}
|
||||
|
||||
if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmdmod.cmod_save_ei == NULL) {
|
||||
if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL) {
|
||||
// Set 'eventignore' to "all".
|
||||
// First save the existing option value for restoring it later.
|
||||
cmdmod.cmod_save_ei = vim_strsave(p_ei);
|
||||
cmod->cmod_save_ei = vim_strsave(p_ei);
|
||||
set_string_option_direct("ei", -1, (char_u *)"all", OPT_FREE, SID_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
/// Undo and free contents of "cmdmod".
|
||||
static void undo_cmdmod(int save_msg_scroll)
|
||||
/// Undo and free contents of "cmod".
|
||||
static void undo_cmdmod(cmdmod_T *cmod)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
if (cmdmod.cmod_verbose_save > 0) {
|
||||
p_verbose = cmdmod.cmod_verbose_save - 1;
|
||||
cmdmod.cmod_verbose_save = 0;
|
||||
if (cmod->cmod_verbose_save > 0) {
|
||||
p_verbose = cmod->cmod_verbose_save - 1;
|
||||
cmod->cmod_verbose_save = 0;
|
||||
}
|
||||
|
||||
if (cmdmod.cmod_did_sandbox) {
|
||||
if (cmod->cmod_did_sandbox) {
|
||||
sandbox--;
|
||||
cmdmod.cmod_did_sandbox = false;
|
||||
cmod->cmod_did_sandbox = false;
|
||||
}
|
||||
|
||||
if (cmdmod.cmod_save_ei != NULL) {
|
||||
if (cmod->cmod_save_ei != NULL) {
|
||||
// Restore 'eventignore' to the value before ":noautocmd".
|
||||
set_string_option_direct("ei", -1, (char_u *)cmdmod.cmod_save_ei, OPT_FREE, SID_NONE);
|
||||
free_string_option((char_u *)cmdmod.cmod_save_ei);
|
||||
cmdmod.cmod_save_ei = NULL;
|
||||
set_string_option_direct("ei", -1, (char_u *)cmod->cmod_save_ei, OPT_FREE, SID_NONE);
|
||||
free_string_option((char_u *)cmod->cmod_save_ei);
|
||||
cmod->cmod_save_ei = NULL;
|
||||
}
|
||||
|
||||
vim_regfree(cmdmod.filter_regmatch.regprog);
|
||||
vim_regfree(cmod->cmod_filter_regmatch.regprog);
|
||||
|
||||
if (cmdmod.cmod_save_msg_silent > 0) {
|
||||
if (cmod->cmod_save_msg_silent > 0) {
|
||||
// messages could be enabled for a serious error, need to check if the
|
||||
// counters don't become negative
|
||||
if (!did_emsg || msg_silent > cmdmod.cmod_save_msg_silent - 1) {
|
||||
msg_silent = cmdmod.cmod_save_msg_silent - 1;
|
||||
if (!did_emsg || msg_silent > cmod->cmod_save_msg_silent - 1) {
|
||||
msg_silent = cmod->cmod_save_msg_silent - 1;
|
||||
}
|
||||
emsg_silent -= cmdmod.cmod_did_esilent;
|
||||
emsg_silent -= cmod->cmod_did_esilent;
|
||||
if (emsg_silent < 0) {
|
||||
emsg_silent = 0;
|
||||
}
|
||||
// Restore msg_scroll, it's set by file I/O commands, even when no
|
||||
// message is actually displayed.
|
||||
msg_scroll = save_msg_scroll;
|
||||
msg_scroll = cmod->cmod_save_msg_scroll;
|
||||
|
||||
// "silent reg" or "silent echo x" inside "redir" leaves msg_col
|
||||
// somewhere in the line. Put it back in the first column.
|
||||
@@ -2716,8 +2713,8 @@ static void undo_cmdmod(int save_msg_scroll)
|
||||
msg_col = 0;
|
||||
}
|
||||
|
||||
cmdmod.cmod_save_msg_silent = 0;
|
||||
cmdmod.cmod_did_esilent = 0;
|
||||
cmod->cmod_save_msg_silent = 0;
|
||||
cmod->cmod_did_esilent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5467,7 +5464,7 @@ static int check_more(int message, bool forceit)
|
||||
if (!forceit && only_one_window()
|
||||
&& ARGCOUNT > 1 && !arg_had_last && n > 0 && quitmore == 0) {
|
||||
if (message) {
|
||||
if ((p_confirm || cmdmod.confirm) && curbuf->b_fname != NULL) {
|
||||
if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && curbuf->b_fname != NULL) {
|
||||
char buff[DIALOG_MSG_SIZE];
|
||||
|
||||
vim_snprintf((char *)buff, DIALOG_MSG_SIZE,
|
||||
@@ -6534,8 +6531,8 @@ static size_t uc_check_code(char *code, size_t len, char *buf, ucmd_T *cmd, exar
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Add modifiers from "cmdmod.split" to "buf". Set "multi_mods" when one was
|
||||
/// added.
|
||||
/// Add modifiers from "cmdmod.cmod_split" to "buf". Set "multi_mods" when one
|
||||
/// was added.
|
||||
///
|
||||
/// @return the number of bytes added
|
||||
size_t add_win_cmd_modifers(char *buf, bool *multi_mods)
|
||||
@@ -6543,28 +6540,28 @@ size_t add_win_cmd_modifers(char *buf, bool *multi_mods)
|
||||
size_t result = 0;
|
||||
|
||||
// :aboveleft and :leftabove
|
||||
if (cmdmod.split & WSP_ABOVE) {
|
||||
if (cmdmod.cmod_split & WSP_ABOVE) {
|
||||
result += add_cmd_modifier(buf, "aboveleft", multi_mods);
|
||||
}
|
||||
// :belowright and :rightbelow
|
||||
if (cmdmod.split & WSP_BELOW) {
|
||||
if (cmdmod.cmod_split & WSP_BELOW) {
|
||||
result += add_cmd_modifier(buf, "belowright", multi_mods);
|
||||
}
|
||||
// :botright
|
||||
if (cmdmod.split & WSP_BOT) {
|
||||
if (cmdmod.cmod_split & WSP_BOT) {
|
||||
result += add_cmd_modifier(buf, "botright", multi_mods);
|
||||
}
|
||||
|
||||
// :tab
|
||||
if (cmdmod.tab > 0) {
|
||||
if (cmdmod.cmod_tab > 0) {
|
||||
result += add_cmd_modifier(buf, "tab", multi_mods);
|
||||
}
|
||||
// :topleft
|
||||
if (cmdmod.split & WSP_TOP) {
|
||||
if (cmdmod.cmod_split & WSP_TOP) {
|
||||
result += add_cmd_modifier(buf, "topleft", multi_mods);
|
||||
}
|
||||
// :vertical
|
||||
if (cmdmod.split & WSP_VERT) {
|
||||
if (cmdmod.cmod_split & WSP_VERT) {
|
||||
result += add_cmd_modifier(buf, "vertical", multi_mods);
|
||||
}
|
||||
return result;
|
||||
@@ -6576,23 +6573,23 @@ size_t uc_mods(char *buf)
|
||||
bool multi_mods = false;
|
||||
|
||||
typedef struct {
|
||||
bool *set;
|
||||
int flag;
|
||||
char *name;
|
||||
} mod_entry_T;
|
||||
static mod_entry_T mod_entries[] = {
|
||||
{ &cmdmod.browse, "browse" },
|
||||
{ &cmdmod.confirm, "confirm" },
|
||||
{ &cmdmod.hide, "hide" },
|
||||
{ &cmdmod.keepalt, "keepalt" },
|
||||
{ &cmdmod.keepjumps, "keepjumps" },
|
||||
{ &cmdmod.keepmarks, "keepmarks" },
|
||||
{ &cmdmod.keeppatterns, "keeppatterns" },
|
||||
{ &cmdmod.lockmarks, "lockmarks" },
|
||||
{ &cmdmod.noswapfile, "noswapfile" }
|
||||
{ CMOD_BROWSE, "browse" },
|
||||
{ CMOD_CONFIRM, "confirm" },
|
||||
{ CMOD_HIDE, "hide" },
|
||||
{ CMOD_KEEPALT, "keepalt" },
|
||||
{ CMOD_KEEPJUMPS, "keepjumps" },
|
||||
{ CMOD_KEEPMARKS, "keepmarks" },
|
||||
{ CMOD_KEEPPATTERNS, "keeppatterns" },
|
||||
{ CMOD_LOCKMARKS, "lockmarks" },
|
||||
{ CMOD_NOSWAPFILE, "noswapfile" }
|
||||
};
|
||||
// the modifiers that are simple flags
|
||||
for (size_t i = 0; i < ARRAY_SIZE(mod_entries); i++) {
|
||||
if (*mod_entries[i].set) {
|
||||
if (cmdmod.cmod_flags & mod_entries[i].flag) {
|
||||
result += add_cmd_modifier(buf, mod_entries[i].name, &multi_mods);
|
||||
}
|
||||
}
|
||||
@@ -6611,7 +6608,7 @@ size_t uc_mods(char *buf)
|
||||
if (p_verbose > 0) {
|
||||
result += add_cmd_modifier(buf, "verbose", &multi_mods);
|
||||
}
|
||||
// flags from cmdmod.split
|
||||
// flags from cmdmod.cmod_split
|
||||
result += add_win_cmd_modifers(buf, &multi_mods);
|
||||
|
||||
return result;
|
||||
@@ -7159,7 +7156,7 @@ void ex_win_close(int forceit, win_T *win, tabpage_T *tp)
|
||||
|
||||
need_hide = (bufIsChanged(buf) && buf->b_nwindows <= 1);
|
||||
if (need_hide && !buf_hide(buf) && !forceit) {
|
||||
if ((p_confirm || cmdmod.confirm) && p_write) {
|
||||
if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write) {
|
||||
bufref_T bufref;
|
||||
set_bufref(&bufref, buf);
|
||||
dialog_changed(buf, false);
|
||||
@@ -7642,7 +7639,7 @@ void ex_splitview(exarg_T *eap)
|
||||
|
||||
// A ":split" in the quickfix window works like ":new". Don't want two
|
||||
// quickfix windows. But it's OK when doing ":tab split".
|
||||
if (bt_quickfix(curbuf) && cmdmod.tab == 0) {
|
||||
if (bt_quickfix(curbuf) && cmdmod.cmod_tab == 0) {
|
||||
if (eap->cmdidx == CMD_split) {
|
||||
eap->cmdidx = CMD_new;
|
||||
}
|
||||
@@ -7664,7 +7661,7 @@ void ex_splitview(exarg_T *eap)
|
||||
* Either open new tab page or split the window.
|
||||
*/
|
||||
if (use_tab) {
|
||||
if (win_new_tabpage(cmdmod.tab != 0 ? cmdmod.tab : eap->addr_count == 0
|
||||
if (win_new_tabpage(cmdmod.cmod_tab != 0 ? cmdmod.cmod_tab : eap->addr_count == 0
|
||||
? 0 : (int)eap->line2 + 1, (char_u *)eap->arg) != FAIL) {
|
||||
do_exedit(eap, old_curwin);
|
||||
apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, false, curbuf);
|
||||
@@ -7673,7 +7670,7 @@ void ex_splitview(exarg_T *eap)
|
||||
if (curwin != old_curwin
|
||||
&& win_valid(old_curwin)
|
||||
&& old_curwin->w_buffer != curbuf
|
||||
&& !cmdmod.keepalt) {
|
||||
&& (cmdmod.cmod_flags & CMOD_KEEPALT) == 0) {
|
||||
old_curwin->w_alt_fnum = curbuf->b_fnum;
|
||||
}
|
||||
}
|
||||
@@ -7831,7 +7828,7 @@ static void ex_resize(exarg_T *eap)
|
||||
}
|
||||
|
||||
n = (int)atol(eap->arg);
|
||||
if (cmdmod.split & WSP_VERT) {
|
||||
if (cmdmod.cmod_split & WSP_VERT) {
|
||||
if (*eap->arg == '-' || *eap->arg == '+') {
|
||||
n += wp->w_width;
|
||||
} else if (n == 0 && eap->arg[0] == NUL) { // default is very wide
|
||||
@@ -8002,7 +7999,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
|
||||
&& curwin != old_curwin
|
||||
&& win_valid(old_curwin)
|
||||
&& old_curwin->w_buffer != curbuf
|
||||
&& !cmdmod.keepalt) {
|
||||
&& (cmdmod.cmod_flags & CMOD_KEEPALT) == 0) {
|
||||
old_curwin->w_alt_fnum = curbuf->b_fnum;
|
||||
}
|
||||
|
||||
@@ -8452,8 +8449,8 @@ static void ex_wincmd(exarg_T *eap)
|
||||
emsg(_(e_invarg));
|
||||
} else if (!eap->skip) {
|
||||
// Pass flags on for ":vertical wincmd ]".
|
||||
postponed_split_flags = cmdmod.split;
|
||||
postponed_split_tab = cmdmod.tab;
|
||||
postponed_split_flags = cmdmod.cmod_split;
|
||||
postponed_split_tab = cmdmod.cmod_tab;
|
||||
do_window(*eap->arg, eap->addr_count > 0 ? eap->line2 : 0L, xchar);
|
||||
postponed_split_flags = 0;
|
||||
postponed_split_tab = 0;
|
||||
@@ -9289,8 +9286,8 @@ static void ex_pedit(exarg_T *eap)
|
||||
static void ex_stag(exarg_T *eap)
|
||||
{
|
||||
postponed_split = -1;
|
||||
postponed_split_flags = cmdmod.split;
|
||||
postponed_split_tab = cmdmod.tab;
|
||||
postponed_split_flags = cmdmod.cmod_split;
|
||||
postponed_split_tab = cmdmod.cmod_tab;
|
||||
ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
|
||||
postponed_split_flags = 0;
|
||||
postponed_split_tab = 0;
|
||||
|
Reference in New Issue
Block a user