aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfischerling <github@muhq.space>2020-12-21 12:48:34 +0100
committerGitHub <noreply@github.com>2020-12-21 12:48:34 +0100
commitcc24d1848702077a85e114ced28b256d9f9c41bb (patch)
tree766fd90aeda45d2f063ca0dd3a838130238cde3f
parentaceaf94e4a3de99dd7d626e3eb22065d7bf58617 (diff)
parentb8117bb9ec7b80028df8ff4deca48272a0501359 (diff)
downloadvis-spellcheck-cc24d1848702077a85e114ced28b256d9f9c41bb.tar.gz
Merge pull request #4 from lepotic/master
Fix arrows in vis-menu by using vis:pipe()
-rw-r--r--spellcheck.lua10
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