summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-23 19:45:01 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-23 19:45:01 +0000
commitac48506ac62b2ece523d5af6ea6c95b699d70b94 (patch)
tree15f7b8ac648f36039c06b1ac67f1067ce988f0eb /src/ex_docmd.c
parentc20e46a4e3efcd408ef132872238144ea34f7ae5 (diff)
patch 8.2.4615: mapping with escaped bar does not work in :def functionv8.2.4615
Problem: Mapping with escaped bar does not work in :def function. (Sergey Vlasov) Solution: Do not remove the backslash. (closes #10002)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index c33dcbca01..a35924a570 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2275,7 +2275,7 @@ do_one_cmd(
*/
if ((ea.argt & EX_TRLBAR) && !ea.usefilter)
{
- separate_nextcmd(&ea);
+ separate_nextcmd(&ea, FALSE);
}
else if (ea.cmdidx == CMD_bang
|| ea.cmdidx == CMD_terminal
@@ -5081,9 +5081,10 @@ repl_cmdline(
/*
* 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;
@@ -5097,7 +5098,7 @@ separate_nextcmd(exarg_T *eap)
{
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
@@ -5144,8 +5145,11 @@ separate_nextcmd(exarg_T *eap)
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
{