From 954f60b5f83b2161a5bb1b6f0fa799e2a34d63c0 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 28 Nov 2023 20:54:00 +0100 Subject: [PATCH] Avoid considering single spaces in `detectindent` (#1595) --- data/plugins/detectindent.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/plugins/detectindent.lua b/data/plugins/detectindent.lua index 8fad044b..9f22c66b 100644 --- a/data/plugins/detectindent.lua +++ b/data/plugins/detectindent.lua @@ -266,7 +266,7 @@ local function detect_indent_stat(doc) local max_lines = auto_detect_max_lines for i, text in get_non_empty_lines(doc.syntax, doc.lines) do local spaces = text:match("^ +") - if spaces then table.insert(stat, spaces:len()) end + if spaces and #spaces > 1 then table.insert(stat, #spaces) end local tabs = text:match("^\t+") if tabs then tab_count = tab_count + 1 end -- if nothing found for first lines try at least 4 more times