patch 9.1.1357: Vim incorrectly escapes tags with "[" in a help buffer

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>
diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim
index 6c8b3ab..6422317 100644
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -205,5 +205,22 @@
   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