diff --git a/src/findreplacepanel.cpp b/src/findreplacepanel.cpp index 4acfd1d..ed0b198 100644 --- a/src/findreplacepanel.cpp +++ b/src/findreplacepanel.cpp @@ -38,7 +38,7 @@ FindReplacePanel::FindReplacePanel ( { parent = parentParameter; findData = findDataParameter; - notFoundSet = false; + incrementalFind = notFoundSet = false; isRegex = isRegexParameter; matchCaseMemory = ( findData->GetFlags() ) & wxFR_MATCHCASE; @@ -145,6 +145,7 @@ void FindReplacePanel::OnFindNext ( wxCommandEvent& event ) findData->SetFindString ( findEdit->GetValue() ); findData->SetReplaceString ( replaceEdit->GetValue() ); + incrementalFind = false; size_t flags = 0; flags |= wxFR_DOWN; if ( matchCaseBox->GetValue() ) @@ -201,6 +202,8 @@ void FindReplacePanel::OnIdle ( wxIdleEvent& event ) if ( newLength != findEditLength || settingsChanged ) { + incrementalFind = true; + size_t flags = 0; flags |= wxFR_DOWN; if ( matchCaseBox->GetValue() ) @@ -231,8 +234,14 @@ void FindReplacePanel::sendFindEvent ( size_t flags ) findData->SetReplaceString ( replaceEdit->GetValue() ); } +bool FindReplacePanel::getIncrementalFind() +{ + return incrementalFind; +} + void FindReplacePanel::refresh() { + incrementalFind = false; findEdit->SetValue ( findData->GetFindString() ); replaceEdit->SetValue ( findData->GetReplaceString() ); diff --git a/src/findreplacepanel.h b/src/findreplacepanel.h index 43d8cea..7cce90d 100644 --- a/src/findreplacepanel.h +++ b/src/findreplacepanel.h @@ -49,6 +49,7 @@ class FindReplacePanel : public wxPanel void OnReplace ( wxCommandEvent& event ); void OnReplaceAll ( wxCommandEvent& event ); void focusOnFind(); + bool getIncrementalFind(); bool getRegex(); void refresh(); void setReplaceVisible ( bool b ); @@ -66,7 +67,7 @@ class FindReplacePanel : public wxPanel wxWindow *parent; size_t findEditLength; bool matchCaseMemory, regexMemory; - bool isReplaceDialog, notFoundSet, isRegex; + bool incrementalFind, isReplaceDialog, notFoundSet, isRegex; void OnIdle ( wxIdleEvent& event ); void sendFindEvent ( size_t flags ); diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index c249271..d0b215b 100644 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -4444,7 +4444,8 @@ void MyFrame::findAgain ( wxString s, int flags ) if ( flags & wxFR_DOWN ) // find next { - doc->SetTargetStart ( doc->GetSelectionStart() ); + doc->SetTargetStart ( findReplacePanel->getIncrementalFind() + ? doc->GetSelectionStart() : doc->GetSelectionEnd() ); doc->SetTargetEnd ( doc->GetLength() ); doc->SetSearchFlags ( myFlags ); newLocation = doc->SearchInTarget ( s );