aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2022-01-25 14:14:56 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2022-01-25 14:14:56 +0100
commit96b7e68c673a7eff7bfceebb30419d8dcbcdaad6 (patch)
treeae17f9f78b845707c93eb5a3e4c5728826149448
parentde1db14d4a9f53c1af1f79ecb463f737c20c2dd8 (diff)
downloadlite-xl-96b7e68c673a7eff7bfceebb30419d8dcbcdaad6.tar.gz
lite-xl-96b7e68c673a7eff7bfceebb30419d8dcbcdaad6.zip
Do no error out on malformed ignore patterns
-rw-r--r--data/core/init.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/data/core/init.lua b/data/core/init.lua
index efd604ec..db1dd08b 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -136,12 +136,15 @@ local function compile_ignore_files()
-- config.ignore_files could be a simple string...
if type(ipatterns) ~= "table" then ipatterns = {ipatterns} end
for i, pattern in ipairs(ipatterns) do
- compiled[i] = {
- use_path = pattern:match("/[^/$]"), -- contains a slash but not at the end
- -- An '/' or '/$' at the end means we want to match a directory.
- match_dir = pattern:match(".+/%$?$"), -- to be used as a boolen value
- pattern = pattern -- get the actual pattern
- }
+ -- we ignore malformed pattern that raise an error
+ if pcall(string.match, "a", pattern) then
+ table.insert(compiled, {
+ use_path = pattern:match("/[^/$]"), -- contains a slash but not at the end
+ -- An '/' or '/$' at the end means we want to match a directory.
+ match_dir = pattern:match(".+/%$?$"), -- to be used as a boolen value
+ pattern = pattern -- get the actual pattern
+ })
+ end
end
return compiled
end