honeylisp/vendor/lite-plugins/plugins/centerdoc.lua
Jeremy Penner cb5132f393 git subrepo clone https://github.com/rxi/lite-plugins vendor/lite-plugins
subrepo:
  subdir:   "vendor/lite-plugins"
  merged:   "de4227d"
upstream:
  origin:   "https://github.com/rxi/lite-plugins"
  branch:   "master"
  commit:   "de4227d"
git-subrepo:
  version:  "0.4.2"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "65fde50"
2020-11-19 21:04:39 -05:00

20 lines
584 B
Lua

local config = require "core.config"
local DocView = require "core.docview"
local draw_line_gutter = DocView.draw_line_gutter
local get_gutter_width = DocView.get_gutter_width
function DocView:draw_line_gutter(idx, x, y)
local offset = self:get_gutter_width() - get_gutter_width(self)
draw_line_gutter(self, idx, x + offset, y)
end
function DocView:get_gutter_width()
local real_gutter_width = 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)
end