From 5894e44ac25010f9043feee8e192c39b8bd08fff Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Thu, 9 Aug 2012 23:00:06 +0800 Subject: [PATCH] Bug #2784140 Find & Replace insert text when nothing was found --- src/xmlcopyeditor.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 627518a..e7c8667 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -1861,14 +1861,17 @@ void MyFrame::OnDialogReplace ( wxFindDialogEvent& event ) if ( ( doc = getActiveDocument() ) == NULL ) return; - int regexWidth = 0; - if ( findReplacePanel->getRegex() ) + if ( !doc->GetSelectedText().IsEmpty() ) { - regexWidth = doc->ReplaceTargetRE ( event.GetReplaceString() ); - } - else - { - doc->ReplaceTarget ( event.GetReplaceString() ); + int regexWidth = 0; + if ( findReplacePanel->getRegex() ) + { + regexWidth = doc->ReplaceTargetRE ( event.GetReplaceString() ); + } + else + { + doc->ReplaceTarget ( event.GetReplaceString() ); + } } OnDialogFind ( event ); }