]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(filetype): Fix Prolog file detection regex
authorigna_martinoli <ignamartinoli@protonmail.com>
Fri, 12 Jul 2024 05:32:21 +0000 (07:32 +0200)
committerChristian Brabandt <cb@256bit.org>
Fri, 12 Jul 2024 05:33:32 +0000 (07:33 +0200)
Problem: filetype: .pro file detection for Prolog is broken
Solution: fixed the regex to only match on the tested
          cases (igna_martinoli)

fixes: #10835
closes: #15206

Signed-off-by: igna_martinoli <ignamartinoli@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/ft.vim

index 6aea180c5475a8172855f7ba707d7fad3dbd1fee..fc844383ed1c2c1c410877de4a6c9576f5a03919 100644 (file)
@@ -465,7 +465,7 @@ export def ProtoCheck(default: string)
     # recognize Prolog by specific text in the first non-empty line
     # require a blank after the '%' because Perl uses "%list" and "%translate"
     var lnum = getline(nextnonblank(1))
-    if lnum =~ '\<prolog\>' || lnum =~ '(^\s*(:-\|%\|\/\*))\|.\s*$'
+    if lnum =~ '\<prolog\>' || lnum =~ '^\(:-\|%\|\/\*\)\|\.$'
       setf prolog
     else
       exe 'setf ' .. default