aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-04-25 10:09:49 +0100
committerrxi <rxi@users.noreply.github.com>2020-04-25 10:09:49 +0100
commit8ebb6baf41dfaa58a193e7daa856e77d016d0499 (patch)
treea7c43a16d5c5f45655fa89ee1bd3e070b63aca89
parent1facb7486758d527bbcab2fc2828320e22b4730a (diff)
downloadlite-xl-plugins-8ebb6baf41dfaa58a193e7daa856e77d016d0499.tar.gz
lite-xl-plugins-8ebb6baf41dfaa58a193e7daa856e77d016d0499.zip
Fixed indentguide plugin to work with hard tabs
-rw-r--r--plugins/indentguide.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/indentguide.lua b/plugins/indentguide.lua
index 9d903b7..9fc6345 100644
--- a/plugins/indentguide.lua
+++ b/plugins/indentguide.lua
@@ -12,7 +12,11 @@ local function get_line_spaces(doc, idx, dir)
if e == #text then
return get_line_spaces(doc, idx + dir, dir)
end
- return e - s + 1
+ local n = 0
+ for i = s, e do
+ n = n + (text:byte(i) == 9 and config.indent_size or 1)
+ end
+ return n
end