diff options
author | Francesco Abbate <francesco.bbt@gmail.com> | 2021-04-08 16:21:43 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-04-08 16:21:43 +0200 |
commit | 536a0ce054319d2ea92c665510afe8a388b043ca (patch) | |
tree | 4f1ba435d7719597d283244f3c8bf6ea8fa00f0b /plugins/drawwhitespace.lua | |
parent | fd4c78986139116e8f629cbb0a92434ce892d1b3 (diff) | |
download | lite-xl-plugins-536a0ce054319d2ea92c665510afe8a388b043ca.tar.gz lite-xl-plugins-536a0ce054319d2ea92c665510afe8a388b043ca.zip |
More validated plugins
Diffstat (limited to 'plugins/drawwhitespace.lua')
-rw-r--r-- | plugins/drawwhitespace.lua | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/plugins/drawwhitespace.lua b/plugins/drawwhitespace.lua deleted file mode 100644 index 4e2e109..0000000 --- a/plugins/drawwhitespace.lua +++ /dev/null @@ -1,38 +0,0 @@ -local common = require "core.common" -local config = require "core.config" -local style = require "core.style" -local DocView = require "core.docview" -local command = require "core.command" - --- originally written by luveti - -config.whitespace_map = { [" "] = "·", ["\t"] = "»" } -config.draw_whitespace = true - -local draw_line_text = DocView.draw_line_text - -function DocView:draw_line_text(idx, x, y) - draw_line_text(self, idx, x, y) - if not config.draw_whitespace then return end - - local text = self.doc.lines[idx] - local font = self:get_font() - local ss = font:subpixel_scale() - local tx, ty = ss * x, y + self:get_line_text_y_offset() - local color = style.whitespace or style.syntax.comment - local map = config.whitespace_map - - for chr in common.utf8_chars(text) do - local rep = map[chr] - if rep then - renderer.draw_text_subpixel(font, rep, tx, ty, color) - end - tx = tx + font:get_width_subpixel(chr) - end -end - -command.add("core.docview", { - ["draw-whitespace:toggle"] = function() config.draw_whitespace = not config.draw_whitespace end, - ["draw-whitespace:disable"] = function() config.draw_whitespace = false end, - ["draw-whitespace:enable"] = function() config.draw_whitespace = true end, -}) |