From 6e3cd41bd1274efa7e5eea2b376c3a5cc24743de Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 6 Apr 2021 08:27:35 +0200 Subject: [PATCH] Logical test simplification in detectindent --- data/plugins/detectindent.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/plugins/detectindent.lua b/data/plugins/detectindent.lua index 090f8d79..2a97e291 100644 --- a/data/plugins/detectindent.lua +++ b/data/plugins/detectindent.lua @@ -105,13 +105,14 @@ local function update_cache(doc) local type, size, score = detect_indent_stat(doc) cache[doc] = { type = type, size = size, confirmed = (score >= adjust_threshold) } doc.indent_info = cache[doc] - if score < adjust_threshold and Doc.on_text_change == doc_on_text_change then + if score < adjust_threshold and doc_on_text_change then Doc.on_text_change = function(self, ...) doc_on_text_change(self, ...) update_cache(self) end - elseif score >= adjust_threshold and Doc.on_text_change ~= doc_on_text_change then + elseif score >= adjust_threshold and doc_on_text_change then Doc.on_text_change = doc_on_text_change + doc_on_text_change = nil end end