comparison src/ex_cmds.c @ 14443:e1c6aee62a72 v8.1.0235

patch 8.1.0235: more help tags that jump to the wrong location commit https://github.com/vim/vim/commit/3bf5e6a4c8eb84b44437d6148428565d44783eed Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 2 22:23:57 2018 +0200 patch 8.1.0235: more help tags that jump to the wrong location Problem: More help tags that jump to the wrong location. Solution: Add more exceptions and a table for "expr-" tags. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Thu, 02 Aug 2018 22:30:05 +0200
parents 90bed90d1130
children 076b9632bda4
comparison
equal deleted inserted replaced
14442:6ae689a04195 14443:e1c6aee62a72
6581 char_u *s, *d; 6581 char_u *s, *d;
6582 int i; 6582 int i;
6583 static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*", 6583 static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
6584 "/*", "/\\*", "\"*", "**", 6584 "/*", "/\\*", "\"*", "**",
6585 "cpo-*", "/\\(\\)", "/\\%(\\)", 6585 "cpo-*", "/\\(\\)", "/\\%(\\)",
6586 "?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??", 6586 "?", ":?", "?<CR>", "g?", "g?g?", "g??",
6587 "-?", "q?", "v_g?",
6587 "/\\?", "/\\z(\\)", "\\=", ":s\\=", 6588 "/\\?", "/\\z(\\)", "\\=", ":s\\=",
6588 "[count]", "[quotex]", 6589 "[count]", "[quotex]",
6589 "[range]", ":[range]", 6590 "[range]", ":[range]",
6590 "[pattern]", "\\|", "\\%$", 6591 "[pattern]", "\\|", "\\%$",
6591 "s/\\~", "s/\\U", "s/\\L", 6592 "s/\\~", "s/\\U", "s/\\L",
6592 "s/\\1", "s/\\2", "s/\\3", "s/\\9"}; 6593 "s/\\1", "s/\\2", "s/\\3", "s/\\9"};
6593 static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star", 6594 static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
6594 "/star", "/\\\\star", "quotestar", "starstar", 6595 "/star", "/\\\\star", "quotestar", "starstar",
6595 "cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)", 6596 "cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
6596 "?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??", 6597 "?", ":?", "?<CR>", "g?", "g?g?", "g??",
6598 "-?", "q?", "v_g?",
6597 "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=", 6599 "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
6598 "\\[count]", "\\[quotex]", 6600 "\\[count]", "\\[quotex]",
6599 "\\[range]", ":\\[range]", 6601 "\\[range]", ":\\[range]",
6600 "\\[pattern]", "\\\\bar", "/\\\\%\\$", 6602 "\\[pattern]", "\\\\bar", "/\\\\%\\$",
6601 "s/\\\\\\~", "s/\\\\U", "s/\\\\L", 6603 "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
6602 "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"}; 6604 "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
6605 static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
6606 ">=?", ">?", "is?", "isnot?"};
6603 int flags; 6607 int flags;
6604 6608
6605 d = IObuff; /* assume IObuff is long enough! */ 6609 d = IObuff; /* assume IObuff is long enough! */
6606 6610
6607 /* 6611 if (STRNICMP(arg, "expr-", 5) == 0)
6608 * Recognize a few exceptions to the rule. Some strings that contain '*' 6612 {
6609 * with "star". Otherwise '*' is recognized as a wildcard. 6613 // When the string starting with "expr-" and containing '?' and matches
6610 */ 6614 // the table, it is taken literally. Otherwise '?' is recognized as a
6611 for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; ) 6615 // wildcard.
6612 if (STRCMP(arg, mtable[i]) == 0) 6616 for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
6613 { 6617 if (STRCMP(arg + 5, expr_table[i]) == 0)
6614 STRCPY(d, rtable[i]); 6618 {
6615 break; 6619 STRCPY(d, arg);
6616 } 6620 break;
6621 }
6622 }
6623 else
6624 {
6625 // Recognize a few exceptions to the rule. Some strings that contain
6626 // '*' with "star". Otherwise '*' is recognized as a wildcard.
6627 for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
6628 if (STRCMP(arg, mtable[i]) == 0)
6629 {
6630 STRCPY(d, rtable[i]);
6631 break;
6632 }
6633 }
6617 6634
6618 if (i < 0) /* no match in table */ 6635 if (i < 0) /* no match in table */
6619 { 6636 {
6620 /* Replace "\S" with "/\\S", etc. Otherwise every tag is matched. 6637 /* Replace "\S" with "/\\S", etc. Otherwise every tag is matched.
6621 * Also replace "\%^" and "\%(", they match every tag too. 6638 * Also replace "\%^" and "\%(", they match every tag too.