diff options
author | Georgi Kirilov <> | 2020-12-20 20:51:07 +0200 |
---|---|---|
committer | Georgi Kirilov <> | 2020-12-20 21:02:42 +0200 |
commit | b8117bb9ec7b80028df8ff4deca48272a0501359 (patch) | |
tree | 766fd90aeda45d2f063ca0dd3a838130238cde3f | |
parent | aceaf94e4a3de99dd7d626e3eb22065d7bf58617 (diff) | |
download | vis-spellcheck-b8117bb9ec7b80028df8ff4deca48272a0501359.tar.gz |
Fix arrows in vis-menu by using vis:pipe()
-rw-r--r-- | spellcheck.lua | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/spellcheck.lua b/spellcheck.lua index 90ba907..d6483df 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -348,12 +348,10 @@ vis:map(vis.modes.NORMAL, "<C-w>w", function(keys) -- select a correction local cmd = 'printf "' .. suggestions:gsub(", ", "\\n") .. '\\n" | vis-menu' - local f = assert(io.popen(cmd)) - local correction = f:read("*all") - f:close() - -- trim correction - correction = correction:match("^%s*(.-)%s*$") - if correction ~= "" then + local status, correction = vis:pipe(file, {start = 0, finish = 0}, cmd) + if status == 0 then + -- trim correction + correction = correction:match("^%s*(.-)%s*$") win.file:delete(range) win.file:insert(range.start, correction) end |