From fb7ed49a44217093f5dd9876b79989c567c639d8 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 f2589ead..05070877 100644 --- a/data/plugins/detectindent.lua +++ b/data/plugins/detectindent.lua @@ -243,7 +243,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