patch 9.1.0558: filetype: prolog detection can be improved

Commit: 
https://github.com/vim/vim/commit/50dc83cf9215aa787da54abbb0bd2ab4fb89e720
Author: igna_martinoli <ignamartin...@protonmail.com>
Date:   Wed Jul 10 21:25:04 2024 +0200

    patch 9.1.0558: filetype: prolog detection can be improved
    
    Problem:  filetype: prolog detection can be improved
    Solution: Improved the Prolog file detection regex and added tests for
              all cases. (igna_martinoli)
    
    fixes: #10835
    closes: #15206
    
    Signed-off-by: igna_martinoli <ignamartin...@protonmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 3c7d85cec..6aea180c5 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -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\|$\)\|/\*\)' || lnum =~ 
':-'
+    if lnum =~ '\<prolog\>' || lnum =~ '(^\s*(:-\|%\|\/\*))\|.\s*$'
       setf prolog
     else
       exe 'setf ' .. default
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 3b0b2e99a..a41078560 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -2576,4 +2576,31 @@ func Test_uci_file()
   filetype off
 endfunc
 
+func Test_pro_file()
+  filetype on
+
+  "Prolog
+  call writefile([':-module(test/1,'], 'Xfile.pro', 'D')
+  split Xfile.pro
+  call assert_equal('prolog', &filetype)
+  bwipe!
+
+  call writefile(['% comment'], 'Xfile.pro', 'D')
+  split Xfile.pro
+  call assert_equal('prolog', &filetype)
+  bwipe!
+
+  call writefile(['/* multiline comment'], 'Xfile.pro', 'D')
+  split Xfile.pro
+  call assert_equal('prolog', &filetype)
+  bwipe!
+
+  call writefile(['rule(test, 1.7).'], 'Xfile.pro', 'D')
+  split Xfile.pro
+  call assert_equal('prolog', &filetype)
+  bwipe!
+
+  filetype off
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 9c076f86b..aaef85fee 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    558,
 /**/
     557,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sRdFT-00Fj8i-QT%40256bit.org.

Raspunde prin e-mail lui