Patch 8.2.1835

7 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 11, 2020, 1:09:09 PM10/11/20
to vim...@googlegroups.com

Patch 8.2.1835
Problem: ":help ??" finds the "!!" tag.
Solution: Do not translate "?" into ".". (Naruhiko Nishino, closes #7114,
closes #7115)
Files: src/help.c, src/testdir/test_help_tagjump.vim


*** ../vim-8.2.1834/src/help.c 2020-10-06 20:46:43.767871541 +0200
--- src/help.c 2020-10-11 19:03:38.457779533 +0200
***************
*** 323,355 ****
{
char_u *s, *d;
int i;
! static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
! "/*", "/\\*", "\"*", "**",
! "cpo-*", "/\\(\\)", "/\\%(\\)",
! "?", ":?", "?<CR>", "g?", "g?g?", "g??",
! "-?", "q?", "v_g?",
! "/\\?", "/\\z(\\)", "\\=", ":s\\=",
! "[count]", "[quotex]",
! "[range]", ":[range]",
! "[pattern]", "\\|", "\\%$",
! "s/\\~", "s/\\U", "s/\\L",
! "s/\\1", "s/\\2", "s/\\3", "s/\\9"};
! static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
! "/star", "/\\\\star", "quotestar", "starstar",
! "cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
! "?", ":?", "?<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!

if (STRNICMP(arg, "expr-", 5) == 0)
{
--- 323,379 ----
{
char_u *s, *d;
int i;
! // Specific tags that either have a specific replacement or won't go
! // throught the generic rules.
! static char *(except_tbl[][2]) = {
! {"*", "star"},
! {"g*", "gstar"},
! {"[*", "[star"},
! {"]*", "]star"},
! {":*", ":star"},
! {"/*", "/star"},
! {"/\\*", "/\\\\star"},
! {"\"*", "quotestar"},
! {"**", "starstar"},
! {"cpo-*", "cpo-star"},
! {"/\\(\\)", "/\\\\(\\\\)"},
! {"/\\%(\\)", "/\\\\%(\\\\)"},
! {"?", "?"},
! {"??", "??"},
! {":?", ":?"},
! {"?<CR>", "?<CR>"},
! {"g?", "g?"},
! {"g?g?", "g?g?"},
! {"g??", "g??"},
! {"-?", "-?"},
! {"q?", "q?"},
! {"v_g?", "v_g?"},
! {"/\\?", "/\\\\?"},
! {"/\\z(\\)", "/\\\\z(\\\\)"},
! {"\\=", "\\\\="},
! {":s\\=", ":s\\\\="},
! {"[count]", "\\[count]"},
! {"[quotex]", "\\[quotex]"},
! {"[range]", "\\[range]"},
! {":[range]", ":\\[range]"},
! {"[pattern]", "\\[pattern]"},
! {"\\|", "\\\\bar"},
! {"\\%$", "/\\\\%\\$"},
! {"s/\\~", "s/\\\\\\~"},
! {"s/\\U", "s/\\\\U"},
! {"s/\\L", "s/\\\\L"},
! {"s/\\1", "s/\\\\1"},
! {"s/\\2", "s/\\\\2"},
! {"s/\\3", "s/\\\\3"},
! {"s/\\9", "s/\\\\9"},
! {NULL, NULL}
! };
static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
! ">=?", ">?", "is?", "isnot?"};
int flags;

d = IObuff; // assume IObuff is long enough!
+ d[0] = NUL;

if (STRNICMP(arg, "expr-", 5) == 0)
{
***************
*** 376,391 ****
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
{
// Replace "\S" with "/\\S", etc. Otherwise every tag is matched.
// Also replace "\%^" and "\%(", they match every tag too.
--- 400,415 ----
else
{
// Recognize a few exceptions to the rule. Some strings that contain
! // '*'are changed to "star", otherwise '*' is recognized as a wildcard.
! for (i = 0; except_tbl[i][0] != NULL; ++i)
! if (STRCMP(arg, except_tbl[i][0]) == 0)
{
! STRCPY(d, except_tbl[i][1]);
break;
}
}

! if (d[0] == NUL) // no match in table
{
// Replace "\S" with "/\\S", etc. Otherwise every tag is matched.
// Also replace "\%^" and "\%(", they match every tag too.
*** ../vim-8.2.1834/src/testdir/test_help_tagjump.vim 2020-02-03 21:40:00.005363654 +0100
--- src/testdir/test_help_tagjump.vim 2020-10-11 18:46:27.988614725 +0200
***************
*** 16,21 ****
--- 16,26 ----
call assert_true(getline('.') =~ '\*quote\*')
helpclose

+ help *
+ call assert_equal("help", &filetype)
+ call assert_true(getline('.') =~ '\*star\*')
+ helpclose
+
help "*
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*quotestar\*')
***************
*** 26,31 ****
--- 31,41 ----
call assert_true(getline('.') =~ '\*:smile\*')
helpclose

+ help ??
+ call assert_equal("help", &filetype)
+ call assert_true(getline('.') =~ '\*??\*')
+ helpclose
+
help :?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*:?\*')
*** ../vim-8.2.1834/src/version.c 2020-10-11 18:04:58.284030792 +0200
--- src/version.c 2020-10-11 18:38:53.617693860 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1835,
/**/

--
hundred-and-one symptoms of being an internet addict:
64. The remote to the T.V. is missing...and you don't even care.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages