`findreplace`: Fix number of total replacements
This commit is contained in:
parent
e0859e1e39
commit
522d8a8094
|
@ -108,9 +108,13 @@ local function replace(kind, default, fn)
|
||||||
submit = function(new)
|
submit = function(new)
|
||||||
core.status_view:remove_tooltip()
|
core.status_view:remove_tooltip()
|
||||||
insert_unique(core.previous_replace, new)
|
insert_unique(core.previous_replace, new)
|
||||||
local n = doc():replace(function(text)
|
local results = doc():replace(function(text)
|
||||||
return fn(text, old, new)
|
return fn(text, old, new)
|
||||||
end)
|
end)
|
||||||
|
local n = 0
|
||||||
|
for _,v in pairs(results) do
|
||||||
|
n = n + v
|
||||||
|
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,
|
end,
|
||||||
suggest = function() return core.previous_replace end,
|
suggest = function() return core.previous_replace end,
|
||||||
|
|
Loading…
Reference in New Issue