patch 9.1.1194: filetype: false positive help filetype detection
Problem: filetype: false positive help filetype detection
Solution: Only detect a file as help if modeline appears either at start
of line or is preceded by whitespace (zeertzjq).
closes: #16845
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index ae69a04..84a4864 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -1634,11 +1634,22 @@
call assert_equal('help', &filetype)
bwipe!
+ call writefile(['some text', 'Copyright: |manual-copyright| vim:ft=help:'],
+ \ 'doc/help1.txt', 'D')
+ split doc/help1.txt
+ call assert_equal('help', &filetype)
+ bwipe!
+
call writefile(['some text'], 'doc/nothelp.txt', 'D')
split doc/nothelp.txt
call assert_notequal('help', &filetype)
bwipe!
+ call writefile(['some text', '`vim:ft=help`'], 'doc/nothelp1.txt', 'D')
+ split doc/nothelp1.txt
+ call assert_notequal('help', &filetype)
+ bwipe!
+
filetype off
set modeline&
endfunc
diff --git a/src/version.c b/src/version.c
index bc21b03..3375888 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1194,
+/**/
1193,
/**/
1192,