diff options
author | 2009-01-25 21:49:43 -0500 | |
---|---|---|
committer | 2009-01-25 21:49:43 -0500 | |
commit | f0c18b47d2d4524c5975481a40bd36b1813417cb (patch) | |
tree | 26a979b2a422fa067a5853969a81baf63f9283bd /core | |
parent | 2066415f82ba4fdda8d6f3020024d9fbf997e3da (diff) | |
download | textadept-f0c18b47d2d4524c5975481a40bd36b1813417cb.tar.gz textadept-f0c18b47d2d4524c5975481a40bd36b1813417cb.zip |
Fix a 'Replace All' bug and make it undo-able; core/ext/find.lua
Diffstat (limited to 'core')
-rw-r--r-- | core/ext/find.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/ext/find.lua b/core/ext/find.lua index e6f7f529..dfb836a4 100644 --- a/core/ext/find.lua +++ b/core/ext/find.lua @@ -179,7 +179,7 @@ function find.replace(rtext) if ret then rtext = rtext:gsub('\\037', '%%') -- unescape '%' buffer:replace_target(rtext:gsub('\\[abfnrtv\\]', escapes)) - buffer:goto_pos(buffer.target_end + 1) -- 'find' text after this replacement + buffer:goto_pos(buffer.target_end) -- 'find' text after this replacement else -- Since find is called after replace returns, have it 'find' the current -- text again, rather than the next occurance so the user can fix the error. @@ -196,6 +196,7 @@ end -- @param flags The number mask identical to the one in 'find'. -- @see find.find function find.replace_all(ftext, rtext, flags) + buffer:begin_undo_action() buffer:goto_pos(0) local count = 0 while(find.find(ftext, true, flags, true)) do @@ -204,6 +205,7 @@ function find.replace_all(ftext, rtext, flags) end textadept.statusbar_text = string.format(textadept.locale.FIND_REPLACEMENTS_MADE, tostring(count)) + buffer:end_undo_action() end --- |