Browse Source

add undo group to replace all

pull/23/head
Siegfried Pammer 14 years ago
parent
commit
8947d92944
  1. 14
      src/AddIns/Misc/SearchAndReplace/Project/Engine/SearchManager.cs
  2. 2
      src/AddIns/Misc/SearchAndReplace/Project/SearchOptions.cs

14
src/AddIns/Misc/SearchAndReplace/Project/Engine/SearchManager.cs

@ -341,12 +341,14 @@ namespace SearchAndReplace @@ -341,12 +341,14 @@ namespace SearchAndReplace
int difference = 0;
ITextEditor textArea = OpenTextArea(searchedFile.FileName, false);
if (textArea != null) {
foreach (var match in searchedFile.Matches) {
ct.ThrowIfCancellationRequested();
string newString = match.TransformReplacePattern(replacement);
textArea.Document.Replace(match.StartOffset + difference, match.Length, newString);
difference += newString.Length - match.Length;
count++;
using (textArea.Document.OpenUndoGroup()) {
foreach (var match in searchedFile.Matches) {
ct.ThrowIfCancellationRequested();
string newString = match.TransformReplacePattern(replacement);
textArea.Document.Replace(match.StartOffset + difference, match.Length, newString);
difference += newString.Length - match.Length;
count++;
}
}
}
}

2
src/AddIns/Misc/SearchAndReplace/Project/SearchOptions.cs

@ -9,7 +9,7 @@ namespace SearchAndReplace @@ -9,7 +9,7 @@ namespace SearchAndReplace
{
public static class SearchOptions
{
const string searchPropertyKey = "SearchAndReplaceProperties";
const string searchPropertyKey = "SearchAndReplaceProperties2";
static Properties properties;

Loading…
Cancel
Save