From a254660268d07ddaedc1ca2db2b5448a04a68c0c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 28 Apr 2020 10:06:26 +0200 Subject: make sure typos is always a string vis:pipe apparently returns nil when the executed command does not write to stdout. fixes #1. --- spellcheck.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spellcheck.lua') diff --git a/spellcheck.lua b/spellcheck.lua index 54cffc4..e84e3db 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -24,7 +24,7 @@ spellcheck.enabled = {} local ignored = {} -local last_viewport, last_typos = nil, nil +local last_viewport, last_typos = nil, "" vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) if not spellcheck.enabled[win] or not win:style_define(42, "fore:red") then @@ -44,7 +44,7 @@ vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) vis:message("calling " .. cmd .. " failed ("..se..")") return false end - typos = so + typos = so or "" end local corrections_iter = typos:gmatch("(.-)\n") -- cgit v1.2.3