]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1357: Vim incorrectly escapes tags with "[" in a help buffer v9.1.1357
authorPhạm Bình An <phambinhanctb2004@gmail.com>
Thu, 1 May 2025 15:30:58 +0000 (17:30 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 1 May 2025 15:30:58 +0000 (17:30 +0200)
Problem:  Vim incorrectly escapes tags containing "[" in a help buffer
Solution: check if the buffer has the "help" filetype set, instead of
          already being a help buffer (Phạm Bình An)

fixes: #17224
closes: #17232

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/normal.c
src/testdir/test_help.vim
src/version.c

index ea30607d6a548fadda2a558a9668cc1ed02b02ba..9231a4c23993719b672f0ae445e0f2f7489de5fb 100644 (file)
@@ -3579,7 +3579,7 @@ nv_ident(cmdarg_T *cap)
            aux_ptr = (char_u *)(magic_isset() ? "/?.*~[^$\\" : "/?^$\\");
        else if (tag_cmd)
        {
-           if (curbuf->b_help)
+           if (STRCMP(curbuf->b_p_ft, "help") == 0)
                // ":help" handles unescaped argument
                aux_ptr = (char_u *)"";
            else
index 6c8b3ab3971ca6ea6a39cc8366cc04087ff58401..6422317de5b2be8da7fb904b0a95db0043ed69c1 100644 (file)
@@ -205,5 +205,22 @@ func Test_help_using_visual_match()
   call v9.CheckScriptFailure(lines, 'E149:')
 endfunc
 
+func Test_helptag_navigation()
+  let helpdir = tempname()
+  let tempfile = helpdir . '/test.txt'
+  call mkdir(helpdir, 'pR')
+  call writefile(['', '*[tag*', '', '|[tag|'], tempfile)
+  exe 'helptags' helpdir
+  exe 'sp' tempfile
+  exe 'lcd' helpdir
+  setl ft=help
+  let &l:iskeyword='!-~,^*,^|,^",192-255'
+  call cursor(4, 2)
+  " Vim must not escape `[` when expanding the tag
+  exe "normal! \<C-]>"
+  call assert_equal(2, line('.'))
+  bw
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index d82060838aee803ed5513219e06f63d7a993b242..30a62c144d64cd384e2008ecd0e21e4fd34e2c89 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1357,
 /**/
     1356,
 /**/