fix(api): make nvim_cmd work correctly with empty arguments list (#18527)

Closes #18526.
This commit is contained in:
Famiu Haque
2022-05-11 22:51:53 +06:00
committed by GitHub
parent a6f4cfdefa
commit cf68f0a512
2 changed files with 6 additions and 1 deletions

View File

@@ -1843,7 +1843,8 @@ int build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdinfo, char
CMDLINE_APPEND(" %s", args[i]);
}
eap->argc = argc;
eap->arg = argc > 0 ? eap->args[0] : NULL;
// If there isn't an argument, make eap->arg point to end of cmd
eap->arg = argc > 0 ? eap->args[0] : cmdline + pos;
// Replace, :make and :grep with 'makeprg' and 'grepprg'.
char *p = replace_makeprg(eap, eap->arg, cmdlinep);