From d74e8da400bb48a90b93c8ab33d010e1c3e47da6 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 7 Mar 2006 22:38:46 +0000 Subject: [PATCH] Pomyk's search and replace patch Originally committed to SVN as r215. --- core/dialog_search_replace.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/dialog_search_replace.cpp b/core/dialog_search_replace.cpp index e73f64268..b88988135 100644 --- a/core/dialog_search_replace.cpp +++ b/core/dialog_search_replace.cpp @@ -305,6 +305,17 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) { OpenDialog(DoReplace); return; } + + wxArrayInt sels = grid->GetSelection(); + // if selection has changed reset values + if (sels[0] < curLine) { + curLine = sels[0]; + Modified = false; + LastWasFind = true; + pos = 0; + matchLen = 0; + replaceLen = 0; + } // Setup int start = curLine; @@ -480,8 +491,7 @@ void SearchReplaceEngine::ReplaceAll() { // Commit if (count > 0) { grid->ass->FlagAsModified(); - if (updateVideo) grid->CommitChanges(); - else Modified = true; + grid->CommitChanges(); wxMessageBox(wxString::Format(_("%i matches were replaced."),count)); } @@ -529,7 +539,8 @@ void SearchReplaceEngine::OpenDialog (bool replace) { // it's the right type so give focus if(replace == hasReplace) { diag->Show(); - diag->SetFocus(); // is needed? + diag->SetFocus(); + OnDialogOpen(); return; } // wrong type - destroy and create the right one