aboutsummaryrefslogtreecommitdiff
path: root/plugins/selectionhighlight.lua
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2023-01-31 23:03:34 +0100
committerGitHub <noreply@github.com>2023-01-31 17:03:34 -0500
commitca40109fb85eca29d7c17c5f5f92808e5ff9fcf6 (patch)
tree5c95875cf162d2ef2afd19ff1a62bb7c2071df3e /plugins/selectionhighlight.lua
parentd7dc1806bf2eea33affbbd1a0a7c64141ee99ebf (diff)
downloadlite-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/selectionhighlight.lua')
-rw-r--r--plugins/selectionhighlight.lua13
1 files changed, 1 insertions, 12 deletions
diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua
index f9bb01e..133dced 100644
--- a/plugins/selectionhighlight.lua
+++ b/plugins/selectionhighlight.lua
@@ -4,17 +4,6 @@ local DocView = require "core.docview"
-- originally written by luveti
--- 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 draw_box(x, y, w, h, color)
local r = renderer.draw_rect
local s = math.ceil(SCALE)
@@ -29,7 +18,7 @@ local draw_line_body = DocView.draw_line_body
function DocView:draw_line_body(line, x, y)
local line_height = draw_line_body(self, line, x, y)
- local line1, col1, line2, col2 = get_selection(self.doc, true)
+ local line1, col1, line2, col2 = self.doc:get_selection(true)
if line1 == line2 and col1 ~= col2 then
local selection = self.doc:get_text(line1, col1, line2, col2)
if not selection:match("^%s+$") then