diff options
author | Aqil Contractor <aqilcm@gmail.com> | 2023-01-21 22:50:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-21 22:50:07 -0500 |
commit | bc047a8a0567e682568feb0c581b970565cd5664 (patch) | |
tree | 2a015e114465177d9073b55227926bc2d7cad7bf /plugins/autoinsert.lua | |
parent | 3eb5ef21dcb560cf41e84f7cba37e957e5138502 (diff) | |
download | lite-xl-plugins-bc047a8a0567e682568feb0c581b970565cd5664.tar.gz lite-xl-plugins-bc047a8a0567e682568feb0c581b970565cd5664.zip |
Fix `autoinsert.lua`'s behavior on multicursor (#195)
* Add guldo's godly changes
* Fix autoinsert on multiple selections
* Updated autoinsert to latest ver
* FIX predicate solution
* Appeal to the Guldo
* Appeal to the Guldo even more
Diffstat (limited to 'plugins/autoinsert.lua')
-rw-r--r-- | plugins/autoinsert.lua | 6 |
1 files changed, 5 insertions, 1 deletions
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, { |