Fixed a problem when replacing '>' with '>>'
Other '>'s except the first one wouldn't be replaced.
This commit is contained in:
parent
ae287e0edb
commit
a34b60072f
|
@ -38,7 +38,7 @@ FindReplacePanel::FindReplacePanel (
|
|||
{
|
||||
parent = parentParameter;
|
||||
findData = findDataParameter;
|
||||
incrementalFind = notFoundSet = false;
|
||||
notFoundSet = false;
|
||||
isRegex = isRegexParameter;
|
||||
|
||||
matchCaseMemory = ( findData->GetFlags() ) & wxFR_MATCHCASE;
|
||||
|
@ -145,7 +145,6 @@ 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() )
|
||||
|
@ -202,8 +201,6 @@ void FindReplacePanel::OnIdle ( wxIdleEvent& event )
|
|||
|
||||
if ( newLength != findEditLength || settingsChanged )
|
||||
{
|
||||
incrementalFind = true;
|
||||
|
||||
size_t flags = 0;
|
||||
flags |= wxFR_DOWN;
|
||||
if ( matchCaseBox->GetValue() )
|
||||
|
@ -234,14 +231,8 @@ 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() );
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ class FindReplacePanel : public wxPanel
|
|||
void OnReplace ( wxCommandEvent& event );
|
||||
void OnReplaceAll ( wxCommandEvent& event );
|
||||
void focusOnFind();
|
||||
bool getIncrementalFind();
|
||||
bool getRegex();
|
||||
void refresh();
|
||||
void setReplaceVisible ( bool b );
|
||||
|
@ -67,7 +66,7 @@ class FindReplacePanel : public wxPanel
|
|||
wxWindow *parent;
|
||||
size_t findEditLength;
|
||||
bool matchCaseMemory, regexMemory;
|
||||
bool incrementalFind, isReplaceDialog, notFoundSet, isRegex;
|
||||
bool isReplaceDialog, notFoundSet, isRegex;
|
||||
|
||||
void OnIdle ( wxIdleEvent& event );
|
||||
void sendFindEvent ( size_t flags );
|
||||
|
|
|
@ -1950,16 +1950,20 @@ void MyFrame::OnDialogReplace ( wxFindDialogEvent& event )
|
|||
if ( ( doc = getActiveDocument() ) == NULL )
|
||||
return;
|
||||
|
||||
if ( !doc->GetSelectedText().IsEmpty() )
|
||||
int start = doc->GetTargetStart();
|
||||
int end = doc->GetTargetEnd();
|
||||
if ( start != end )
|
||||
{
|
||||
if ( findReplacePanel->getRegex() )
|
||||
{
|
||||
doc->ReplaceTargetRE ( event.GetReplaceString() );
|
||||
start += doc->ReplaceTargetRE ( event.GetReplaceString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
doc->ReplaceTarget ( event.GetReplaceString() );
|
||||
start += doc->ReplaceTarget ( event.GetReplaceString() );
|
||||
}
|
||||
// Move to the next position
|
||||
doc->SetEmptySelection ( start );
|
||||
}
|
||||
OnDialogFind ( event );
|
||||
}
|
||||
|
@ -4587,15 +4591,11 @@ void MyFrame::findAgain ( wxString s, int flags )
|
|||
if ( findReplacePanel->getRegex() )
|
||||
myFlags |= wxSTC_FIND_REGEXP;
|
||||
|
||||
bool incrementalFind =
|
||||
( findReplacePanel->getIncrementalFind() ) ? true : false;
|
||||
|
||||
//doc->SetYCaretPolicy(wxSTC_CARET_SLOP | wxSTC_CARET_STRICT, 10);
|
||||
|
||||
if ( flags & wxFR_DOWN ) // find next
|
||||
{
|
||||
doc->SetTargetStart ( ( incrementalFind ) ?
|
||||
doc->GetSelectionStart() : doc->GetSelectionEnd() );
|
||||
doc->SetTargetStart ( doc->GetSelectionStart() );
|
||||
doc->SetTargetEnd ( doc->GetLength() );
|
||||
doc->SetSearchFlags ( myFlags );
|
||||
newLocation = doc->SearchInTarget ( s );
|
||||
|
|
Loading…
Reference in New Issue