diff options
author | rxi <rxi@users.noreply.github.com> | 2020-06-27 13:55:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-27 13:55:28 +0100 |
commit | 91c72734b5b8ccbccb4200b2fe9b9a5f880f0f36 (patch) | |
tree | 6f6f41389871aef23aad98f14c21ae363b2764c9 | |
parent | 76144065f71d08ec5eb0ccc7309d847c871a3d11 (diff) | |
parent | 080fee63d13c8fcaabd9fed53dd2635c540e4239 (diff) | |
download | lite-xl-plugins-91c72734b5b8ccbccb4200b2fe9b9a5f880f0f36.tar.gz lite-xl-plugins-91c72734b5b8ccbccb4200b2fe9b9a5f880f0f36.zip |
Merge pull request #68 from SwissalpS/toggleDrawWhiteSpace
toggle whitespace visibility during runtime
-rw-r--r-- | plugins/drawwhitespace.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/drawwhitespace.lua b/plugins/drawwhitespace.lua index 016d18c..a0eb77d 100644 --- a/plugins/drawwhitespace.lua +++ b/plugins/drawwhitespace.lua @@ -1,15 +1,18 @@ 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() @@ -27,3 +30,8 @@ function DocView:draw_line_text(idx, x, y) end end +command.add("core.docview", { + ["drawwhitespace:toggle"] = function() config.draw_whitespace = not config.draw_whitespace end, + ["drawwhitespace:disable"] = function() config.draw_whitespace = false end, + ["drawwhitespace:enable"] = function() config.draw_whitespace = true end, +}) |