diff options
author | rxi <rxi@users.noreply.github.com> | 2020-05-16 19:53:17 +0100 |
---|---|---|
committer | rxi <rxi@users.noreply.github.com> | 2020-05-16 19:54:16 +0100 |
commit | f2e5821e22b5f813fae1b6d3087b3d75c82f438b (patch) | |
tree | 3e7e519289bb9872290fae128f26df743214f496 /plugins/centerdoc.lua | |
parent | 4312007bad8d14861baec21d67e2b583e6f56121 (diff) | |
download | lite-xl-plugins-f2e5821e22b5f813fae1b6d3087b3d75c82f438b.tar.gz lite-xl-plugins-f2e5821e22b5f813fae1b6d3087b3d75c82f438b.zip |
Added ./plugins/centerdoc.lua
Diffstat (limited to 'plugins/centerdoc.lua')
-rw-r--r-- | plugins/centerdoc.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/centerdoc.lua b/plugins/centerdoc.lua new file mode 100644 index 0000000..1921467 --- /dev/null +++ b/plugins/centerdoc.lua @@ -0,0 +1,19 @@ +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 |