diff options
author | liquidev <liquidekgaming@gmail.com> | 2021-03-12 22:27:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 22:27:33 +0100 |
commit | 8215ca9c01bb3a1c38afe96407e0d3413913c162 (patch) | |
tree | 73ae8322f504b44b51821d2ff5b8d4828960a442 | |
parent | 634991001afb35a8b3e6a3281d45b61bfc50e9bd (diff) | |
download | lite-xl-plugins-8215ca9c01bb3a1c38afe96407e0d3413913c162.tar.gz lite-xl-plugins-8215ca9c01bb3a1c38afe96407e0d3413913c162.zip |
updated indentguide with Lite XL support
-rw-r--r-- | plugins/indentguide.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/indentguide.lua b/plugins/indentguide.lua index daf7d8b..db57f9e 100644 --- a/plugins/indentguide.lua +++ b/plugins/indentguide.lua @@ -34,12 +34,16 @@ local draw_line_text = DocView.draw_line_text function DocView:draw_line_text(idx, x, y) local spaces = get_line_indent_guide_spaces(self.doc, idx) - local sw = self:get_font():get_width(" ") local w = math.ceil(1 * SCALE) local h = self:get_line_height() - for i = 0, spaces - 1, config.indent_size do + local sspaces = "" + local font = self:get_font() + local ss = font:subpixel_scale() + for _ = 0, spaces - 1, config.indent_size do local color = style.guide or style.selection - renderer.draw_rect(x + sw * i, y, w, h, color) + local sw = font:get_width_subpixel(sspaces) / ss + renderer.draw_rect(x + sw, y, w, h, color) + sspaces = sspaces .. (' '):rep(config.indent_size) end draw_line_text(self, idx, x, y) end |