aboutsummaryrefslogtreecommitdiff
path: root/plugins/extend_selection_line.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-11-01 20:57:07 -0400
committerjgmdev <jgmdev@gmail.com>2022-11-01 20:57:07 -0400
commit49139e03398c9d0ecb347267a4882a4eb3f7ee23 (patch)
tree6ac890a209172a29e09ad47ccd0156e7f7114382 /plugins/extend_selection_line.lua
parent380f6ef5fe9f8af19cd1f6b4c043eede51cbfcae (diff)
parent0971a7a686a4e18ee31b576c460966a5ec20ff01 (diff)
downloadlite-xl-plugins-49139e03398c9d0ecb347267a4882a4eb3f7ee23.tar.gz
lite-xl-plugins-49139e03398c9d0ecb347267a4882a4eb3f7ee23.zip
Merge branch '2.1'
Diffstat (limited to 'plugins/extend_selection_line.lua')
-rw-r--r--plugins/extend_selection_line.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/extend_selection_line.lua b/plugins/extend_selection_line.lua
index e986597..e002674 100644
--- a/plugins/extend_selection_line.lua
+++ b/plugins/extend_selection_line.lua
@@ -1,19 +1,20 @@
--- mod-version:2 -- lite-xl 2.0
+-- mod-version:3
local DocView = require "core.docview"
local style = require "core.style"
local draw_line_body = DocView.draw_line_body
-function DocView:draw_line_body(idx, x, y, ...)
- draw_line_body(self, idx, x, y, ...)
+function DocView:draw_line_body(line, x, y)
+ local line_height = draw_line_body(self, line, x, y)
local lh = self:get_line_height()
for _, line1, _, line2, _ in self.doc:get_selections(true) do
- if idx >= line1 and idx < line2 and line1 ~= line2 then
+ if line >= line1 and line < line2 and line1 ~= line2 then
-- draw selection from the end of the line to the end of the available space
- local x1 = x + self:get_col_x_offset(idx, #self.doc.lines[idx])
+ local x1 = x + self:get_col_x_offset(line, #self.doc.lines[line])
local x2 = x + self.scroll.x + self.size.x
if x2 > x1 then
renderer.draw_rect(x1, y, x2 - x1, lh, style.selection)
end
end
end
+ return line_height
end