aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+orbitalquark@users.noreply.github.com>2020-09-12 15:00:02 -0400
committermitchell <70453897+orbitalquark@users.noreply.github.com>2020-09-12 15:00:02 -0400
commit040625ef4426a6ffe0e057f1fbc3e91f1e9661de (patch)
tree7cb5adbaac8f3b8b1140417227dd95d754156549
parentf13b1bbde296c839c4b2fc3081a461cb5590f82c (diff)
downloadtextadept-040625ef4426a6ffe0e057f1fbc3e91f1e9661de.tar.gz
textadept-040625ef4426a6ffe0e057f1fbc3e91f1e9661de.zip
Fixed restoration of replace entry text after "Replace All".
-rw-r--r--modules/textadept/find.lua2
-rw-r--r--test/test.lua4
2 files changed, 5 insertions, 1 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 84590c32..7d04d694 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -403,7 +403,7 @@ events.connect(events.REPLACE_ALL, function(ftext, rtext)
end
local EOF = replace_in_sel and e == buffer.length + 1 -- no indicator at EOF
local f = not M.regex and buffer.replace_target or buffer.replace_target_re
- rtext = unescape(rtext)
+ rtext, repl_text = unescape(rtext), rtext -- save for ui.find.focus()
-- Perform the search and replace.
buffer:begin_undo_action()
diff --git a/test/test.lua b/test/test.lua
index 6b1c4b52..425bede6 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -2402,6 +2402,10 @@ function test_ui_find_replace_text_save_restore()
assert(ui.find.replace_entry_text ~= 'bar', 'filter entry text not set')
ui.find.focus{in_files = false} -- simulate activating "Find"
assert_equal(ui.find.replace_entry_text, 'bar')
+ ui.find.replace_entry_text = 'baz'
+ ui.find.replace_all()
+ ui.find.focus() -- simulate activating "Find"
+ assert_equal(ui.find.replace_entry_text, 'baz')
end
function test_ui_find_replace_all()