From 6fcdafc5b6eb0906f0bfa8e034cf4b0a84d08958 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Fri, 19 Feb 2021 09:23:55 +0100 Subject: [PATCH] Adjust line numbers for detect indent --- data/plugins/detectindent.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/plugins/detectindent.lua b/data/plugins/detectindent.lua index ab65bb2f..18ce6224 100644 --- a/data/plugins/detectindent.lua +++ b/data/plugins/detectindent.lua @@ -62,11 +62,12 @@ end local function get_non_empty_lines(syntax, lines) return coroutine.wrap(function() local tokens, state - for i, line in ipairs(lines) do + local i = 0 + for _, line in ipairs(lines) do tokens, state = tokenizer.tokenize(syntax, line, state) local line_start = get_first_line_part(tokens) if line_start then - -- note that i below correpond to unfiltered lines numeber + i = i + 1 coroutine.yield(i, line_start) end end @@ -74,7 +75,7 @@ local function get_non_empty_lines(syntax, lines) end -local auto_detect_max_lines = 300 +local auto_detect_max_lines = 200 local function detect_indent_stat(doc) local stat = {}