diff options
author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-04-28 10:06:26 +0200 |
---|---|---|
committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-04-28 10:06:26 +0200 |
commit | a254660268d07ddaedc1ca2db2b5448a04a68c0c (patch) | |
tree | 25b89ff8c7a2fa0bc54fe6a4cb5f22bdb62079c9 | |
parent | d71e6bd763f0e32f38aaec9cc66f5a3c4e533886 (diff) | |
download | vis-spellcheck-a254660268d07ddaedc1ca2db2b5448a04a68c0c.tar.gz |
make sure typos is always a string
vis:pipe apparently returns nil when the executed command does not
write to stdout.
fixes #1.
-rw-r--r-- | spellcheck.lua | 4 |
1 files changed, 2 insertions, 2 deletions
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") |