File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 5151import org .eclipse .jface .resource .JFaceColors ;
5252import org .eclipse .jface .window .Window ;
5353
54+ import org .eclipse .jface .text .FindReplaceDocumentAdapter ;
5455import org .eclipse .jface .text .IFindReplaceTarget ;
5556import org .eclipse .jface .text .IFindReplaceTargetExtension ;
5657import org .eclipse .jface .text .ITextViewer ;
@@ -902,16 +903,19 @@ private void performSearch(boolean forward) {
902903 }
903904
904905 private void updateFromTargetSelection () {
905- String initText = findReplaceLogic .getTarget ().getSelectionText ();
906- if (initText .isEmpty ()) {
906+ String selectionText = findReplaceLogic .getTarget ().getSelectionText ();
907+ if (selectionText .isEmpty ()) {
907908 return ;
908909 }
909- if (initText .contains (System .lineSeparator ())) { // $NON-NLS-1$
910+ if (selectionText .contains (System .lineSeparator ())) {
910911 findReplaceLogic .deactivate (SearchOptions .GLOBAL );
911912 searchInSelectionButton .setSelection (true );
912913 } else {
913- searchBar .setText (initText );
914- searchBar .setSelection (0 , initText .length ());
914+ if (findReplaceLogic .isRegExSearchAvailableAndActive ()) {
915+ selectionText = FindReplaceDocumentAdapter .escapeForRegExPattern (selectionText );
916+ }
917+ searchBar .setText (selectionText );
918+ searchBar .setSelection (0 , selectionText .length ());
915919 }
916920 }
917921
You can’t perform that action at this time.
0 commit comments