aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-09-15 19:32:19 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-09-16 08:16:07 +0200
commitf408603f4fc10ef2ff2dd3b6550365109b0b6214 (patch)
tree38eb5c7099920b633ac94e726cafb7a5bbac73f6
parent78b85109338592c2bc89154278f2e961a14eee96 (diff)
downloadrneovim-f408603f4fc10ef2ff2dd3b6550365109b0b6214.tar.gz
rneovim-f408603f4fc10ef2ff2dd3b6550365109b0b6214.tar.bz2
rneovim-f408603f4fc10ef2ff2dd3b6550365109b0b6214.zip
vim-patch:9.1.0731: inconsistent case sensitive extension matching
Problem: inconsistent case sensitive extension matching Solution: unify case sensitive extension matching (Evgeni Chasnovski). There are different approaches of how extensions are matched with respect to case sensitivity. In particular, '\c' flag is used in pattern whereas in most places case sensitive matching is guarded behind `has("fname_case")` condition. Replace all instances of '\c' with an explicit case sensitive pattern variants guarded by `has("fname_case")`. Strictly speaking, this is a breaking change because only two (most common and prevailingly tested) variants are now matched: upper first letter and upper all letters. closes: vim/vim#15672 https://github.com/vim/vim/commit/59b089c9df238ce940b3c593295bc511e201399a Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
-rw-r--r--runtime/lua/vim/filetype.lua40
-rw-r--r--test/old/testdir/test_filetype.vim15
2 files changed, 7 insertions, 48 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index a287607386..bfe700f8dd 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -280,12 +280,7 @@ local extension = {
cfi = 'cf',
hgrc = 'cfg',
cfg = detect.cfg,
- cfG = detect.cfg,
- cFg = detect.cfg,
- cFG = detect.cfg,
Cfg = detect.cfg,
- CfG = detect.cfg,
- CFg = detect.cfg,
CFG = detect.cfg,
chf = 'ch',
chai = 'chaiscript',
@@ -370,12 +365,7 @@ local extension = {
drt = 'dart',
ds = 'datascript',
dat = detect.dat,
- daT = detect.dat,
- dAt = detect.dat,
- dAT = detect.dat,
Dat = detect.dat,
- DaT = detect.dat,
- DAt = detect.dat,
DAT = detect.dat,
dcd = 'dcd',
decl = detect.decl,
@@ -658,12 +648,7 @@ local extension = {
kt = 'kotlin',
ktm = 'kotlin',
sub = 'krl',
- suB = 'krl',
- sUb = 'krl',
- sUB = 'krl',
Sub = 'krl',
- SuB = 'krl',
- SUb = 'krl',
SUB = 'krl',
ks = 'kscript',
k = 'kwt',
@@ -699,12 +684,7 @@ local extension = {
lite = 'lite',
livemd = 'livebook',
log = detect.log,
- loG = detect.log,
- lOg = detect.log,
- lOG = detect.log,
Log = detect.log,
- LoG = detect.log,
- LOg = detect.log,
LOG = detect.log,
lgt = 'logtalk',
lotos = 'lotos',
@@ -773,12 +753,7 @@ local extension = {
mmp = 'mmp',
mms = detect.mms,
mod = detect.mod,
- moD = detect.mod,
- mOd = detect.mod,
- mOD = detect.mod,
Mod = detect.mod,
- MoD = detect.mod,
- MOd = detect.mod,
MOD = detect.mod,
DEF = 'modula2',
m3 = 'modula3',
@@ -948,12 +923,7 @@ local extension = {
ih = 'ppwiz',
action = 'privoxy',
prg = detect.prg,
- prG = detect.prg,
- pRg = detect.prg,
- pRG = detect.prg,
Prg = detect.prg,
- PrG = detect.prg,
- PRg = detect.prg,
PRG = detect.prg,
pc = 'proc',
pdb = 'prolog',
@@ -1133,12 +1103,7 @@ local extension = {
sqr = 'sqr',
nut = 'squirrel',
src = detect.src,
- srC = detect.src,
- sRc = detect.src,
- sRC = detect.src,
Src = detect.src,
- SrC = detect.src,
- SRc = detect.src,
SRC = detect.src,
s28 = 'srec',
s37 = 'srec',
@@ -1168,12 +1133,7 @@ local extension = {
swig = 'swig',
swg = 'swig',
sys = detect.sys,
- syS = detect.sys,
- sYs = detect.sys,
- sYS = detect.sys,
Sys = detect.sys,
- SyS = detect.sys,
- SYs = detect.sys,
SYS = detect.sys,
svh = 'systemverilog',
sv = 'systemverilog',
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 9c47dfa16f..33f8df4081 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -1150,15 +1150,14 @@ func Test_cfg_file()
unlet g:filetype_cfg
" RAPID cfg
- let ext = 'cfg'
for i in ['EIO', 'MMC', 'MOC', 'PROC', 'SIO', 'SYS']
- call writefile([i .. ':CFG'], 'cfgfile.' .. ext)
- execute "split cfgfile." .. ext
- call assert_equal('rapid', &filetype)
- bwipe!
- call delete('cfgfile.' .. ext)
- " check different case of file extension
- let ext = substitute(ext, '\(\l\)', '\u\1', '')
+ for ext in ['cfg', 'Cfg', 'CFG']
+ call writefile([i .. ':CFG'], 'cfgfile.' .. ext)
+ execute "split cfgfile." .. ext
+ call assert_equal('rapid', &filetype)
+ bwipe!
+ call delete('cfgfile.' .. ext)
+ endfor
endfor
" clean up