aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2023-05-27 21:15:09 +0200
committerGuldoman <giulio.lettieri@gmail.com>2023-05-27 21:15:09 +0200
commit6386bd03b1782d0e2364ec971f5b87373a0e2d9e (patch)
tree7c4500124e16ed6fb1e6d60acf97b00227b784db
parentca617f5317d16d0ba0af074a68ee2ce46c343889 (diff)
downloadlite-xl-plugins-6386bd03b1782d0e2364ec971f5b87373a0e2d9e.tar.gz
lite-xl-plugins-6386bd03b1782d0e2364ec971f5b87373a0e2d9e.zip
Use plaintext `string.find` in `lfautoinsert` to check for `close` tags
-rw-r--r--manifest.json2
-rw-r--r--plugins/lfautoinsert.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/manifest.json b/manifest.json
index a6cd6b6..16f934e 100644
--- a/manifest.json
+++ b/manifest.json
@@ -931,7 +931,7 @@
},
{
"description": "Automatically inserts indentation and closing bracket/text after newline",
- "version": "0.2",
+ "version": "0.2.1",
"path": "plugins/lfautoinsert.lua",
"id": "lfautoinsert",
"mod_version": "3"
diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua
index 3e5302f..12a3b76 100644
--- a/plugins/lfautoinsert.lua
+++ b/plugins/lfautoinsert.lua
@@ -90,7 +90,7 @@ command.add("core.docview!", {
then
close = str and close:gsub("$TEXT", str) or close
-- Avoid inserting `close` if it's already present
- if remainder:find("^"..close) then
+ if remainder:find(close, 1, true) == 1 then
close = ""
end
post = string.format("\n%s%s", current_indent, close)