summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-05 11:30:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-05 11:30:09 +0200
commit9ca250855b55f4d3292b010525c827dc6992cb61 (patch)
tree323c839cb49b0eb3bdcdc9521a01cf9d4812582f /src/ex_cmds.c
parent4c063dde73c618b0728016d221ef130d9e9ec968 (diff)
patch 8.1.2113: ":help expr-!~?" only works after searchingv8.1.2113
Problem: ":help expr-!~?" only works after searching. Solution: Escape "~" after "expr-". (closes #5015)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 85e5be066d..da01e9ddad 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5547,12 +5547,22 @@ find_help_tags(
if (STRNICMP(arg, "expr-", 5) == 0)
{
// When the string starting with "expr-" and containing '?' and matches
- // the table, it is taken literally. Otherwise '?' is recognized as a
- // wildcard.
+ // the table, it is taken literally (but ~ is escaped). Otherwise '?'
+ // is recognized as a wildcard.
for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg + 5, expr_table[i]) == 0)
{
- STRCPY(d, arg);
+ int si = 0, di = 0;
+
+ for (;;)
+ {
+ if (arg[si] == '~')
+ d[di++] = '\\';
+ d[di++] = arg[si];
+ if (arg[si] == NUL)
+ break;
+ ++si;
+ }
break;
}
}