diff options
author | Guldoman <giulio.lettieri@gmail.com> | 2023-01-31 23:03:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 17:03:34 -0500 |
commit | ca40109fb85eca29d7c17c5f5f92808e5ff9fcf6 (patch) | |
tree | 5c95875cf162d2ef2afd19ff1a62bb7c2071df3e /plugins/autoinsert.lua | |
parent | d7dc1806bf2eea33affbbd1a0a7c64141ee99ebf (diff) | |
download | lite-xl-plugins-ca40109fb85eca29d7c17c5f5f92808e5ff9fcf6.tar.gz lite-xl-plugins-ca40109fb85eca29d7c17c5f5f92808e5ff9fcf6.zip |
Remove workaround for sorted `Doc:get_selection` issue (#197)
* `dragdropselected`: Replace deprecated `math.pow` with `^`
* Remove workaround for sorted `Doc:get_selection` issue
Reverts 94f7c8b33371e49d6f026f5be6a41acd73ad9c6b.
Diffstat (limited to 'plugins/autoinsert.lua')
-rw-r--r-- | plugins/autoinsert.lua | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index a210955..b5fb783 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -18,18 +18,6 @@ config.plugins.autoinsert = common.merge({ map = { } }, config.plugins.autoinsert) --- Workaround for bug in Lite XL 2.1 --- Remove this when b029f5993edb7dee5ccd2ba55faac1ec22e24609 is in a release -local function get_selection(doc, sort) - local line1, col1, line2, col2 = doc:get_selection_idx(doc.last_selection) - if line1 then - return doc:get_selection_idx(doc.last_selection, sort) - else - return doc:get_selection_idx(1, sort) - end -end - - local function is_closer(chr) for _, v in pairs(config.plugins.autoinsert.map) do if v == chr then @@ -63,7 +51,7 @@ function DocView:on_text_input(text) -- wrap selection if we have a selection if mapping and self.doc:has_selection() then - local l1, c1, l2, c2, swap = get_selection(self.doc, true) + local l1, c1, l2, c2, swap = self.doc:get_selection(true) self.doc:insert(l2, c2, mapping) self.doc:insert(l1, c1, text) self.doc:set_selection(l1, c1, l2, c2 + 2, swap) |