aboutsummaryrefslogtreecommitdiff
path: root/plugins/spellcheck.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/spellcheck.lua')
-rw-r--r--plugins/spellcheck.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins/spellcheck.lua b/plugins/spellcheck.lua
index 23a5fa9..cd3e0f1 100644
--- a/plugins/spellcheck.lua
+++ b/plugins/spellcheck.lua
@@ -214,18 +214,21 @@ command.add("core.docview", {
-- select word and init replacement selector
local label = string.format("Replace \"%s\" With", word)
doc:set_selection(line, e + 1, line, s)
- core.command_view:enter(label, function(text, item)
- text = item and item.text or text
- doc:replace(function() return text end)
- end, function(text)
- local t = {}
- for _, w in ipairs(suggestions) do
- if w:lower():find(text:lower(), 1, true) then
- table.insert(t, w)
+ core.command_view:enter(label, {
+ submit = function(text, item)
+ text = item and item.text or text
+ doc:replace(function() return text end)
+ end,
+ suggest = function(text)
+ local t = {}
+ for _, w in ipairs(suggestions) do
+ if w:lower():find(text:lower(), 1, true) then
+ table.insert(t, w)
+ end
end
+ return t
end
- return t
- end)
+ })
end,
})