From 4533c40786a68d57b878babd46ea70e761392cf0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 11 Mar 2025 06:23:12 +0800 Subject: vim-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: vim/vim#16845 https://github.com/vim/vim/commit/6763b0ee95e7e66ab7992653fbba48691e803e70 --- test/old/testdir/test_filetype.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 3d8772e477..633166c5ce 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1628,11 +1628,22 @@ func Test_help_file() 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 -- cgit