*/
if ((ea.argt & EX_TRLBAR) && !ea.usefilter)
{
- separate_nextcmd(&ea);
+ separate_nextcmd(&ea, FALSE);
}
else if (ea.cmdidx == CMD_bang
|| ea.cmdidx == CMD_terminal
/*
* Check for '|' to separate commands and '"' to start comments.
+ * If "keep_backslash" is TRUE do not remove any backslash.
*/
void
-separate_nextcmd(exarg_T *eap)
+separate_nextcmd(exarg_T *eap, int keep_backslash)
{
char_u *p;
{
if (*p == Ctrl_V)
{
- if (eap->argt & (EX_CTRLV | EX_XFILE))
+ if ((eap->argt & (EX_CTRLV | EX_XFILE)) || keep_backslash)
++p; // skip CTRL-V and next char
else
// remove CTRL-V and skip next char
if ((vim_strchr(p_cpo, CPO_BAR) == NULL
|| !(eap->argt & EX_CTRLV)) && *(p - 1) == '\\')
{
- STRMOVE(p - 1, p); // remove the '\'
- --p;
+ if (!keep_backslash)
+ {
+ STRMOVE(p - 1, p); // remove the '\'
+ --p;
+ }
}
else
{
char_u *skip_range(char_u *cmd_start, int skip_star, int *ctx);
void ex_ni(exarg_T *eap);
int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp);
-void separate_nextcmd(exarg_T *eap);
+void separate_nextcmd(exarg_T *eap, int keep_backslash);
char_u *skip_cmd_arg(char_u *p, int rembs);
int get_bad_opt(char_u *p, exarg_T *eap);
int ends_excmd(int c);
* filename to include.
*/
eap->argt |= (EX_XFILE | EX_NOSPC);
- separate_nextcmd(eap);
+ separate_nextcmd(eap, FALSE);
if (*eap->arg == '<' || *eap->arg == '$' || mch_isFullName(eap->arg))
{
// For an absolute path, "$VIM/..." or "<sfile>.." we ":source" the
nnoremap <F3> :echo 'hit F3 #'<CR>
assert_equal(":echo 'hit F3 #'<CR>", maparg("<F3>", "n"))
END
- v9.CheckDefSuccess(lines)
- v9.CheckScriptSuccess(['vim9script'] + lines)
+ v9.CheckDefAndScriptSuccess(lines)
+
+ # backslash before bar is not removed
+ lines =<< trim END
+ vim9script
+
+ def Init()
+ noremap <buffer> <F5> <ScriptCmd>MyFunc('a') \| MyFunc('b')<CR>
+ enddef
+ Init()
+ unmap <buffer> <F5>
+ END
+ v9.CheckScriptSuccess(lines)
enddef
def Test_normal_command()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4615,
/**/
4614,
/**/
if ((argt & EX_TRLBAR) && !usefilter)
{
eap->argt = argt;
- separate_nextcmd(eap);
+ separate_nextcmd(eap, TRUE);
if (eap->nextcmd != NULL)
nextcmd = eap->nextcmd;
}