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/sort.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/sort.lua')
-rw-r--r-- | plugins/sort.lua | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/plugins/sort.lua b/plugins/sort.lua index 899475e..b933bb4 100644 --- a/plugins/sort.lua +++ b/plugins/sort.lua @@ -3,17 +3,6 @@ local core = require "core" local command = require "core.command" local translate = require "core.doc.translate" --- 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 split_lines(text) local res = {} for line in (text .. "\n"):gmatch("(.-)\n") do @@ -26,7 +15,7 @@ command.add("core.docview!", { ["sort:sort"] = function(dv) local doc = dv.doc - local l1, c1, l2, c2, swap = get_selection(doc, true) + local l1, c1, l2, c2, swap = doc:get_selection(true) l1, c1 = translate.start_of_line(doc, l1, c1) l2, c2 = translate.end_of_line(doc, l2, c2) doc:set_selection(l1, c1, l2, c2, swap) |