patch 9.0.1797: Vimball/Visual Basic filetype detection conflict

Problem:  Vimball/Visual Basic filetype detection conflict
Solution: runtime(vb): Improve Vimball and Visual Basic detection logic

Only run Vimball Archiver's BufEnter autocommand on Vimball archives.
Fixes #2694.

closes: #12899

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
Doug Kearns
2023-08-27 18:44:09 +02:00
committed by Christian Brabandt
parent 5c018bee0e
commit f97f6bbf56
5 changed files with 81 additions and 16 deletions

View File

@ -62,7 +62,7 @@ export def FTasmsyntax()
endif
enddef
var ft_visual_basic_content = '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
var ft_visual_basic_content = '\c^\s*\%(Attribute\s\+VB_Name\|Begin\s\+\%(VB\.\|{\%(\x\+-\)\+\x\+}\)\)'
# See FTfrm() for Visual Basic form file detection
export def FTbas()
@ -146,11 +146,13 @@ export def FTcls()
return
endif
if getline(1) =~ '^\v%(\%|\\)'
var line1 = getline(1)
if line1 =~ '^\v%(\%|\\)'
setf tex
elseif getline(1)[0] == '#' && getline(1) =~ 'rexx'
elseif line1[0] == '#' && line1 =~ 'rexx'
setf rexx
elseif getline(1) == 'VERSION 1.0 CLASS'
elseif line1 == 'VERSION 1.0 CLASS'
setf vb
else
setf st
@ -324,6 +326,11 @@ export def FTfrm()
return
endif
if getline(1) == "VERSION 5.00"
setf vb
return
endif
var lines = getline(1, min([line("$"), 5]))
if match(lines, ft_visual_basic_content) > -1
@ -1197,5 +1204,13 @@ export def FTv()
setf v
enddef
export def FTvba()
if getline(1) =~ '^["#] Vimball Archiver'
setf vim
else
setf vb
endif
enddef
# Uncomment this line to check for compilation errors early
# defcompile