changeset 18237:d0dfb3b0fe31 v8.1.2113

patch 8.1.2113: ":help expr-!~?" only works after searching Commit: https://github.com/vim/vim/commit/9ca250855b55f4d3292b010525c827dc6992cb61 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 5 11:30:09 2019 +0200 patch 8.1.2113: ":help expr-!~?" only works after searching Problem: ":help expr-!~?" only works after searching. Solution: Escape "~" after "expr-". (closes https://github.com/vim/vim/issues/5015)
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Oct 2019 11:45:04 +0200
parents 2a76cb925e40
children 545afb8a9207
files src/ex_cmds.c src/testdir/test_help.vim src/version.c
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	    }
     }
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -20,6 +20,12 @@ func Test_help_errors()
   bwipe!
 endfunc
 
+func Test_help_expr()
+  help expr-!~?
+  call assert_equal('eval.txt', expand('%:t'))
+  close
+endfunc
+
 func Test_help_keyword()
   new
   set keywordprg=:help
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2113,
+/**/
     2112,
 /**/
     2111,