diff options
author | Takase <20792268+takase1121@users.noreply.github.com> | 2021-05-31 11:18:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 11:18:12 +0800 |
commit | 0d87d70140b8c318ca171330658d3a7cf00f5037 (patch) | |
tree | eb333ce5d63f7f393b61ac544124be5398496d3a /plugins/drawwhitespace.lua | |
parent | a07e30be3827f9444f967ba633171ea8c90cd41e (diff) | |
parent | 5b9a3bd28d937d131da5821f075952df80c14040 (diff) | |
download | lite-xl-plugins-0d87d70140b8c318ca171330658d3a7cf00f5037.tar.gz lite-xl-plugins-0d87d70140b8c318ca171330658d3a7cf00f5037.zip |
Merge branch 'master' into contextmenu
Diffstat (limited to 'plugins/drawwhitespace.lua')
-rw-r--r-- | plugins/drawwhitespace.lua | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/plugins/drawwhitespace.lua b/plugins/drawwhitespace.lua deleted file mode 100644 index c6ed07d..0000000 --- a/plugins/drawwhitespace.lua +++ /dev/null @@ -1,37 +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 tx, ty = x, y + self:get_line_text_y_offset() - local font = self:get_font() - 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(font, rep, tx, ty, color) - end - tx = tx + font:get_width(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, -}) |