diff options
Diffstat (limited to 'data/plugins/detectindent.lua')
| -rw-r--r-- | data/plugins/detectindent.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/data/plugins/detectindent.lua b/data/plugins/detectindent.lua index d323adb5..090f8d79 100644 --- a/data/plugins/detectindent.lua +++ b/data/plugins/detectindent.lua @@ -98,20 +98,20 @@ local function detect_indent_stat(doc) end -local doc_text_input = Doc.text_input +local doc_on_text_change = Doc.on_text_change local adjust_threshold = 4 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.text_input == doc_text_input then - Doc.text_input = function(self, ...) - doc_text_input(self, ...) + if score < adjust_threshold and Doc.on_text_change == 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.text_input ~= doc_text_input then - Doc.text_input = doc_text_input + elseif score >= adjust_threshold and Doc.on_text_change ~= doc_on_text_change then + Doc.on_text_change = doc_on_text_change end end |
