aboutsummaryrefslogtreecommitdiff
path: root/plugins/regexreplacepreview.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/regexreplacepreview.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/regexreplacepreview.lua')
-rw-r--r--plugins/regexreplacepreview.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/regexreplacepreview.lua b/plugins/regexreplacepreview.lua
index 7ca8bc1..8abd39c 100644
--- a/plugins/regexreplacepreview.lua
+++ b/plugins/regexreplacepreview.lua
@@ -95,12 +95,11 @@ command.add("core.docview", {
local doc = view.doc
local original_selection = { doc:get_selection(true) }
local selection = doc:has_selection() and { doc:get_selection(true) } or {}
- core.command_view:enter(
- "Regex Replace (enter pattern as /old/new/)",
- function(pattern)
+ core.command_view:enter("Regex Replace (enter pattern as /old/new/)", {
+ submit = function(pattern)
regex_replace_file(view, pattern, {}, false, selection[1], selection[3])
end,
- function(pattern)
+ suggest = function(pattern)
local incremental, has_replacement = regex_replace_file(
view, pattern, old_lines, true, selection[1], selection[3]
)
@@ -111,7 +110,7 @@ command.add("core.docview", {
doc:set_selection(table.unpack(original_selection))
end
end,
- function(pattern)
+ cancel = function(pattern)
for k,v in pairs(old_lines) do
if v then
if k == #doc.lines then
@@ -124,7 +123,7 @@ command.add("core.docview", {
end
doc:set_selection(table.unpack(original_selection))
end
- )
+ })
end
})