diff options
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | plugins/autoinsert.lua | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/manifest.json b/manifest.json index ec27726..a2ffccf 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ }, { "description": "Automatically inserts closing brackets and quotes. Also allows selected text to be wrapped with brackets or quotes.", - "version": "0.1", + "version": "0.2", "path": "plugins/autoinsert.lua", "id": "autoinsert", "mod_version": "3" diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index f6a8924..a210955 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -50,6 +50,10 @@ end local on_text_input = DocView.on_text_input function DocView:on_text_input(text) + + -- Don't insert on multiselections + if #self.doc.selections > 4 then return on_text_input(self, text) end + local mapping = config.plugins.autoinsert.map[text] -- prevents plugin from operating on `CommandView` @@ -94,7 +98,7 @@ end local function predicate() return core.active_view:is(DocView) - and not core.active_view.doc:has_selection(), core.active_view.doc + and #core.active_view.doc.selections <= 4 and not core.active_view.doc:has_selection(), core.active_view.doc end command.add(predicate, { |