1
0
forked from aniani/vim

runtime(filetype): Fix Prolog file detection regex

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>
This commit is contained in:
igna_martinoli 2024-07-12 07:32:21 +02:00 committed by Christian Brabandt
parent 1ee7420460
commit 7347642633
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

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