From e9abdcbcc92518668d1c338b6fabf45055775f01 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 15 Jun 2022 20:54:23 -0400 Subject: centerdoc: fix gutter width issues --- plugins/centerdoc.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins') 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 -- cgit v1.2.3