diff options
author | jgmdev <jgmdev@gmail.com> | 2022-05-22 14:37:28 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-05-22 14:37:28 -0400 |
commit | 76bacb1fe9d0d92bb8c22a6767a98b0589d4bdd3 (patch) | |
tree | 11091b18f989d310fe43996b60e15ff482520c50 /plugins/extend_selection_line.lua | |
parent | 694132ec9d81ced3d8c6ebbf10e451bbc5a9e65b (diff) | |
download | lite-xl-plugins-76bacb1fe9d0d92bb8c22a6767a98b0589d4bdd3.tar.gz lite-xl-plugins-76bacb1fe9d0d92bb8c22a6767a98b0589d4bdd3.zip |
Fix various plugins for linewrapping
Diffstat (limited to 'plugins/extend_selection_line.lua')
-rw-r--r-- | plugins/extend_selection_line.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/extend_selection_line.lua b/plugins/extend_selection_line.lua index dcdde73..968399c 100644 --- a/plugins/extend_selection_line.lua +++ b/plugins/extend_selection_line.lua @@ -3,17 +3,18 @@ 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 |