aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-17 09:59:32 +0800
committerGitHub <noreply@github.com>2022-07-17 09:59:32 +0800
commit9f837a5dcf61e0b27778dd7127036e12d694d92c (patch)
treeb665f68f4c0966126245707ac6a49db262515d90 /src
parent08a50f6690f4dd0260c3e57b6223d0a9fae9dfd8 (diff)
downloadrneovim-9f837a5dcf61e0b27778dd7127036e12d694d92c.tar.gz
rneovim-9f837a5dcf61e0b27778dd7127036e12d694d92c.tar.bz2
rneovim-9f837a5dcf61e0b27778dd7127036e12d694d92c.zip
fix(api): fix nvim_parse_cmd interfere with printing line in Ex mode (#19400)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index f0ee849047..c5f393e2ce 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1444,10 +1444,13 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **er
eap->getline = NULL;
eap->cookie = NULL;
+ const bool save_ex_pressedreturn = ex_pressedreturn;
// Parse command modifiers
if (parse_command_modifiers(eap, errormsg, &cmdinfo->cmdmod, false) == FAIL) {
+ ex_pressedreturn = save_ex_pressedreturn;
goto err;
}
+ ex_pressedreturn = save_ex_pressedreturn;
after_modifier = eap->cmd;
// Save location after command modifiers
@@ -2407,7 +2410,8 @@ char *ex_errmsg(const char *const msg, const char *const arg)
/// - Set ex_pressedreturn for an empty command line.
///
/// @param skip_only if false, undo_cmdmod() must be called later to free
-/// any cmod_filter_pat and cmod_filter_regmatch.regprog.
+/// any cmod_filter_pat and cmod_filter_regmatch.regprog,
+/// and ex_pressedreturn may be set.
/// @param[out] errormsg potential error message.
///
/// Call apply_cmdmod() to get the side effects of the modifiers:
@@ -2421,7 +2425,7 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, cmdmod_T *cmod, bool
{
char *p;
- memset(cmod, 0, sizeof(*cmod));
+ CLEAR_POINTER(cmod);
// Repeat until no more command modifiers are found.
for (;;) {