From 49fc493834c9b450ed102e261e65577a88291008 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 16 Jun 2022 00:32:07 -0400 Subject: updates to new command_view:enter interface --- plugins/regexreplacepreview.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'plugins/regexreplacepreview.lua') 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 }) -- cgit v1.2.3