summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-02 22:23:57 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-02 22:23:57 +0200
commit3bf5e6a4c8eb84b44437d6148428565d44783eed (patch)
tree9afc0f707c95747dc66301d004da3e908e7b3b2d
parent41c363a3154dd1caeb431fa54748ad48ef6d3bd1 (diff)
patch 8.1.0235: more help tags that jump to the wrong locationv8.1.0235
Problem: More help tags that jump to the wrong location. Solution: Add more exceptions and a table for "expr-" tags. (Hirohito Higashi)
-rw-r--r--src/ex_cmds.c41
-rw-r--r--src/testdir/test_help_tagjump.vim23
-rw-r--r--src/version.c2
3 files changed, 54 insertions, 12 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 37331519ab..2c57776404 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -6583,7 +6583,8 @@ find_help_tags(
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
"/*", "/\\*", "\"*", "**",
"cpo-*", "/\\(\\)", "/\\%(\\)",
- "?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
+ "?", ":?", "?<CR>", "g?", "g?g?", "g??",
+ "-?", "q?", "v_g?",
"/\\?", "/\\z(\\)", "\\=", ":s\\=",
"[count]", "[quotex]",
"[range]", ":[range]",
@@ -6593,27 +6594,43 @@ find_help_tags(
static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
"/star", "/\\\\star", "quotestar", "starstar",
"cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
- "?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
+ "?", ":?", "?<CR>", "g?", "g?g?", "g??",
+ "-?", "q?", "v_g?",
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
"\\[count]", "\\[quotex]",
"\\[range]", ":\\[range]",
"\\[pattern]", "\\\\bar", "/\\\\%\\$",
"s/\\\\\\~", "s/\\\\U", "s/\\\\L",
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
+ static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
+ ">=?", ">?", "is?", "isnot?"};
int flags;
d = IObuff; /* assume IObuff is long enough! */
- /*
- * Recognize a few exceptions to the rule. Some strings that contain '*'
- * with "star". Otherwise '*' is recognized as a wildcard.
- */
- for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
- if (STRCMP(arg, mtable[i]) == 0)
- {
- STRCPY(d, rtable[i]);
- break;
- }
+ 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.
+ for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
+ if (STRCMP(arg + 5, expr_table[i]) == 0)
+ {
+ STRCPY(d, arg);
+ break;
+ }
+ }
+ else
+ {
+ // Recognize a few exceptions to the rule. Some strings that contain
+ // '*' with "star". Otherwise '*' is recognized as a wildcard.
+ for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
+ if (STRCMP(arg, mtable[i]) == 0)
+ {
+ STRCPY(d, rtable[i]);
+ break;
+ }
+ }
if (i < 0) /* no match in table */
{
diff --git a/src/testdir/test_help_tagjump.vim b/src/testdir/test_help_tagjump.vim
index 00a96b2271..46aa6a1caf 100644
--- a/src/testdir/test_help_tagjump.vim
+++ b/src/testdir/test_help_tagjump.vim
@@ -26,11 +26,34 @@ func Test_help_tagjump()
call assert_true(getline('.') =~ '\*:?\*')
helpclose
+ help q?
+ call assert_equal("help", &filetype)
+ call assert_true(getline('.') =~ '\*q?\*')
+ call assert_true(expand('<cword>') == 'q?')
+ helpclose
+
help -?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*-?\*')
helpclose
+ help v_g?
+ call assert_equal("help", &filetype)
+ call assert_true(getline('.') =~ '\*v_g?\*')
+ helpclose
+
+ help expr-!=?
+ call assert_equal("help", &filetype)
+ call assert_true(getline('.') =~ '\*expr-!=?\*')
+ call assert_true(expand('<cword>') == 'expr-!=?')
+ helpclose
+
+ help expr-isnot?
+ call assert_equal("help", &filetype)
+ call assert_true(getline('.') =~ '\*expr-isnot?\*')
+ call assert_true(expand('<cword>') == 'expr-isnot?')
+ helpclose
+
help FileW*Post
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*FileWritePost\*')
diff --git a/src/version.c b/src/version.c
index 482b38e38a..f93e099a6c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 235,
+/**/
234,
/**/
233,