aboutsummaryrefslogtreecommitdiff
path: root/plugins/linenumbers.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-05-22 14:37:28 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-22 14:37:28 -0400
commit76bacb1fe9d0d92bb8c22a6767a98b0589d4bdd3 (patch)
tree11091b18f989d310fe43996b60e15ff482520c50 /plugins/linenumbers.lua
parent694132ec9d81ced3d8c6ebbf10e451bbc5a9e65b (diff)
downloadlite-xl-plugins-76bacb1fe9d0d92bb8c22a6767a98b0589d4bdd3.tar.gz
lite-xl-plugins-76bacb1fe9d0d92bb8c22a6767a98b0589d4bdd3.zip
Fix various plugins for linewrapping
Diffstat (limited to 'plugins/linenumbers.lua')
-rw-r--r--plugins/linenumbers.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/linenumbers.lua b/plugins/linenumbers.lua
index b61e3e4..76c691d 100644
--- a/plugins/linenumbers.lua
+++ b/plugins/linenumbers.lua
@@ -10,26 +10,27 @@ config.plugins.linenumbers = common.merge({
relative = false
}, config.plugins.linenumbers)
-local draw = DocView.draw_line_gutter
+local draw_line_gutter = DocView.draw_line_gutter
local get_width = DocView.get_gutter_width
-function DocView:draw_line_gutter(idx, x, y, width)
+function DocView:draw_line_gutter(line, x, y, width)
+ local lh = self:get_line_height()
if
not config.plugins.linenumbers.show
and
not config.plugins.linenumbers.relative
then
- return
+ return lh
end
if config.plugins.linenumbers.relative then
local color = style.line_number
- local local_idx = idx
+ local local_idx = line
local align = "right"
local l1 = self.doc:get_selection(false)
- if idx == l1 then
+ if line == l1 then
color = style.line_number2
if config.line_numbers then
align = "center"
@@ -37,7 +38,7 @@ function DocView:draw_line_gutter(idx, x, y, width)
local_idx = 0
end
else
- local_idx = math.abs(idx - l1)
+ local_idx = math.abs(line - l1)
end
-- Fix for old version (<=1.16)
@@ -52,11 +53,12 @@ function DocView:draw_line_gutter(idx, x, y, width)
color, local_idx, align,
x + style.padding.x,
y + self:get_line_text_y_offset(),
- width, self:get_line_height()
+ width, lh
)
else
- draw(self, idx, x, y, width)
+ draw_line_gutter(self, line, x, y, width)
end
+ return lh
end
function DocView:get_gutter_width(...)