Pomyk's search and replace patch

Originally committed to SVN as r215.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-07 22:38:46 +00:00
parent b3618d42df
commit d74e8da400

View file

@ -306,6 +306,17 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
return; 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 // Setup
int start = curLine; int start = curLine;
int nrows = grid->GetRows(); int nrows = grid->GetRows();
@ -480,8 +491,7 @@ void SearchReplaceEngine::ReplaceAll() {
// Commit // Commit
if (count > 0) { if (count > 0) {
grid->ass->FlagAsModified(); grid->ass->FlagAsModified();
if (updateVideo) grid->CommitChanges(); grid->CommitChanges();
else Modified = true;
wxMessageBox(wxString::Format(_("%i matches were replaced."),count)); 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 // it's the right type so give focus
if(replace == hasReplace) { if(replace == hasReplace) {
diag->Show(); diag->Show();
diag->SetFocus(); // is needed? diag->SetFocus();
OnDialogOpen();
return; return;
} }
// wrong type - destroy and create the right one // wrong type - destroy and create the right one