From fa8b3b33b180d265f472877a23fb8df9a9eca191 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 7 Sep 2021 18:08:54 +0200 Subject: [PATCH] Use hidden suggestions also for replace dialog --- data/core/commands/findreplace.lua | 7 +++++-- data/core/init.lua | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/core/commands/findreplace.lua b/data/core/commands/findreplace.lua index 73a5ae07..7027f293 100644 --- a/data/core/commands/findreplace.lua +++ b/data/core/commands/findreplace.lua @@ -78,19 +78,22 @@ local function replace(kind, default, fn) core.command_view:set_text(default, true) core.status_view:show_tooltip(get_find_tooltip()) + core.command_view:set_hidden_suggestions() core.command_view:enter("Find To Replace " .. kind, function(old) core.command_view:set_text(old, true) local s = string.format("Replace %s %q With", kind, old) + core.command_view:set_hidden_suggestions() core.command_view:enter(s, function(new) + table.insert(core.previous_replace, new) local n = doc():replace(function(text) return fn(text, old, new) end) core.log("Replaced %d instance(s) of %s %q with %q", n, kind, old, new) - end, function() end, function() + end, function() return core.previous_replace end, function() core.status_view:remove_tooltip() end) - end, function() end, function() + end, function() return core.previous_find end, function() core.status_view:remove_tooltip() end) end diff --git a/data/core/init.lua b/data/core/init.lua index b1072b38..1978ce38 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -497,6 +497,7 @@ function core.init() core.redraw = true core.visited_files = {} core.previous_find = {} + core.previous_replace = {} core.restart_request = false core.quit_request = false core.replacements = whitespace_replacements()