aboutsummaryrefslogtreecommitdiff
path: root/plugins/spellcheck.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-06-16 00:32:07 -0400
committerjgmdev <jgmdev@gmail.com>2022-06-16 00:32:07 -0400
commit49fc493834c9b450ed102e261e65577a88291008 (patch)
treedd30ac8d0b4952f7a7499b9583d327a30656571f /plugins/spellcheck.lua
parentd8fbb5ea0c65e01c441e7b9917dcb97da60e8f2b (diff)
downloadlite-xl-plugins-49fc493834c9b450ed102e261e65577a88291008.tar.gz
lite-xl-plugins-49fc493834c9b450ed102e261e65577a88291008.zip
updates to new command_view:enter interface
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,
})