diff options
author | jgmdev <jgmdev@gmail.com> | 2022-06-16 00:32:07 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-06-16 00:32:07 -0400 |
commit | 49fc493834c9b450ed102e261e65577a88291008 (patch) | |
tree | dd30ac8d0b4952f7a7499b9583d327a30656571f /plugins/regexreplacepreview.lua | |
parent | d8fbb5ea0c65e01c441e7b9917dcb97da60e8f2b (diff) | |
download | lite-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.lua | 11 |
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 }) |