Use hidden suggestions also for replace dialog
This commit is contained in:
parent
4bcc1cc07c
commit
fa8b3b33b1
|
@ -78,19 +78,22 @@ local function replace(kind, default, fn)
|
||||||
core.command_view:set_text(default, true)
|
core.command_view:set_text(default, true)
|
||||||
|
|
||||||
core.status_view:show_tooltip(get_find_tooltip())
|
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:enter("Find To Replace " .. kind, function(old)
|
||||||
core.command_view:set_text(old, true)
|
core.command_view:set_text(old, true)
|
||||||
|
|
||||||
local s = string.format("Replace %s %q With", kind, old)
|
local s = string.format("Replace %s %q With", kind, old)
|
||||||
|
core.command_view:set_hidden_suggestions()
|
||||||
core.command_view:enter(s, function(new)
|
core.command_view:enter(s, function(new)
|
||||||
|
table.insert(core.previous_replace, new)
|
||||||
local n = doc():replace(function(text)
|
local n = doc():replace(function(text)
|
||||||
return fn(text, old, new)
|
return fn(text, old, new)
|
||||||
end)
|
end)
|
||||||
core.log("Replaced %d instance(s) of %s %q with %q", n, kind, old, new)
|
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()
|
core.status_view:remove_tooltip()
|
||||||
end)
|
end)
|
||||||
end, function() end, function()
|
end, function() return core.previous_find end, function()
|
||||||
core.status_view:remove_tooltip()
|
core.status_view:remove_tooltip()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -497,6 +497,7 @@ function core.init()
|
||||||
core.redraw = true
|
core.redraw = true
|
||||||
core.visited_files = {}
|
core.visited_files = {}
|
||||||
core.previous_find = {}
|
core.previous_find = {}
|
||||||
|
core.previous_replace = {}
|
||||||
core.restart_request = false
|
core.restart_request = false
|
||||||
core.quit_request = false
|
core.quit_request = false
|
||||||
core.replacements = whitespace_replacements()
|
core.replacements = whitespace_replacements()
|
||||||
|
|
Loading…
Reference in New Issue