aboutsummaryrefslogtreecommitdiff
path: root/plugins/centerdoc.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-06-15 20:54:23 -0400
committerjgmdev <jgmdev@gmail.com>2022-06-15 20:54:23 -0400
commite9abdcbcc92518668d1c338b6fabf45055775f01 (patch)
treef6fab72048585c089ffe34eece83fbbfea40a596 /plugins/centerdoc.lua
parent3eda1ddc31412623aa5c1d6ea829d07021e6e3d6 (diff)
downloadlite-xl-plugins-e9abdcbcc92518668d1c338b6fabf45055775f01.tar.gz
lite-xl-plugins-e9abdcbcc92518668d1c338b6fabf45055775f01.zip
centerdoc: fix gutter width issues
Diffstat (limited to 'plugins/centerdoc.lua')
-rw-r--r--plugins/centerdoc.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/centerdoc.lua b/plugins/centerdoc.lua
index 0cea084..980cbed 100644
--- a/plugins/centerdoc.lua
+++ b/plugins/centerdoc.lua
@@ -21,7 +21,7 @@ function DocView:draw_line_gutter(line, x, y, width)
if not config.plugins.centerdoc.enabled then
lh = draw_line_gutter(self, line, x, y, width)
else
- local real_gutter_width = get_gutter_width(self)
+ local real_gutter_width = self:get_font():get_width(#self.doc.lines)
local offset = self:get_gutter_width() - real_gutter_width * 2
lh = draw_line_gutter(self, line, x + offset, y, real_gutter_width)
end
@@ -33,9 +33,9 @@ function DocView:get_gutter_width()
if not config.plugins.centerdoc.enabled then
return get_gutter_width(self)
else
- local real_gutter_width = get_gutter_width(self)
+ local real_gutter_width, gutter_padding = get_gutter_width(self)
local width = real_gutter_width + self:get_font():get_width("n") * config.line_limit
- return math.max((self.size.x - width) / 2, real_gutter_width)
+ return math.max((self.size.x - width) / 2, real_gutter_width), gutter_padding
end
end