IDEA-146832 Add the "In selection" checkbox on the find tool equals to the replace...
authorTagir Valeev <Tagir.Valeev@jetbrains.com>
Thu, 5 Sep 2019 09:33:09 +0000 (16:33 +0700)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 5 Sep 2019 10:01:25 +0000 (10:01 +0000)
Also minor things:
- Refuse to search if regexp matches an empty string
- Ctrl+R always toggles in-selection mode in replace (same with Ctrl+F in search)
- Do not reset anything on find<=>replace switch

GitOrigin-RevId: 57593153dd811d509b1b09a742b88342fc23ca97

platform/lang-impl/src/com/intellij/find/EditorSearchSession.java
platform/lang-impl/src/com/intellij/find/FindUtil.java
platform/lang-impl/src/com/intellij/find/SearchReplaceComponent.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/OccurrenceAction.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/SwitchToFind.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/SwitchToReplace.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleSelectionOnlyAction.java
platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
platform/platform-resources-en/src/messages/ApplicationBundle.properties

index f4688e6981c69062f5bd3b2b49759930cc553d9f..fc18c66b3703eadcb38d5618709034ad0b94a03f 100644 (file)
@@ -15,14 +15,12 @@ import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
 import com.intellij.openapi.actionSystem.ex.DefaultCustomComponentAction;
 import com.intellij.openapi.application.ApplicationBundle;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.EditorFactory;
-import com.intellij.openapi.editor.RangeMarker;
-import com.intellij.openapi.editor.ScrollType;
+import com.intellij.openapi.editor.*;
 import com.intellij.openapi.editor.event.EditorFactoryEvent;
 import com.intellij.openapi.editor.event.EditorFactoryListener;
 import com.intellij.openapi.editor.event.SelectionEvent;
 import com.intellij.openapi.editor.event.SelectionListener;
+import com.intellij.openapi.keymap.KeymapUtil;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
@@ -30,7 +28,9 @@ import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.ui.components.labels.LinkLabel;
+import com.intellij.util.ArrayUtil;
 import com.intellij.util.ObjectUtils;
+import com.intellij.util.ui.ComponentWithEmptyText;
 import com.intellij.util.ui.UIUtil;
 import com.intellij.util.ui.update.Activatable;
 import com.intellij.util.ui.update.UiNotifyConnector;
@@ -43,6 +43,7 @@ import javax.swing.text.JTextComponent;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 /**
  * @author max, andrey.zaytsev
@@ -60,8 +61,10 @@ public class EditorSearchSession implements SearchSession,
   @NotNull
   private final FindModel myFindModel;
   private final SearchReplaceComponent myComponent;
-  private final RangeMarker myStartSessionSelectionMarker;
-  private final RangeMarker myStartSessionCaretMarker;
+  private RangeMarker myStartSessionSelectionMarker;
+  private RangeMarker myStartSessionCaretMarker;
+  private String myStartSelectedText;
+  private boolean mySelectionUpdatedFromSearchResults;
 
   private final LinkLabel<Object> myClickToHighlightLabel = new LinkLabel<>("Click to highlight", null, (__, ___) -> {
     setMatchesLimit(Integer.MAX_VALUE);
@@ -81,14 +84,7 @@ public class EditorSearchSession implements SearchSession,
     myFindModel = findModel;
 
     myEditor = editor;
-    myStartSessionSelectionMarker = myEditor.getDocument().createRangeMarker(
-      myEditor.getSelectionModel().getSelectionStart(),
-      myEditor.getSelectionModel().getSelectionEnd()
-    );
-    myStartSessionCaretMarker = myEditor.getDocument().createRangeMarker(
-      myEditor.getCaretModel().getOffset(),
-      myEditor.getCaretModel().getOffset()
-    );
+    saveInitialSelection();
 
     mySearchResults = new SearchResults(myEditor, project);
     myLivePreviewController = new LivePreviewController(mySearchResults, this, myDisposable);
@@ -109,6 +105,7 @@ public class EditorSearchSession implements SearchSession,
                                  new ToggleExceptCommentsAction(),
                                  new ToggleExceptLiteralsAction(),
                                  new ToggleExceptCommentsAndLiteralsAction())
+      .addPrimarySearchActions(new ToggleSelectionOnlyAction())
       .addExtraSearchActions(new ToggleMatchCase(),
                              new ToggleWholeWordsOnlyAction(),
                              new ToggleRegex(),
@@ -120,8 +117,7 @@ public class EditorSearchSession implements SearchSession,
       .addPrimaryReplaceActions(new ReplaceAction(),
                                 new ReplaceAllAction(),
                                 new ExcludeAction())
-      .addExtraReplaceAction(new TogglePreserveCaseAction(),
-                             new ToggleSelectionOnlyAction())
+      .addExtraReplaceAction(new TogglePreserveCaseAction())
       .addReplaceFieldActions(new PrevOccurrenceAction(false),
                               new NextOccurrenceAction(false))
       .withDataProvider(this)
@@ -164,8 +160,12 @@ public class EditorSearchSession implements SearchSession,
             if (myFindModel.getStringToFind().isEmpty() && myFindModel.isGlobal()) {
               myFindModel.setStringToFind(StringUtil.notNullize(myEditor.getSelectionModel().getSelectedText()));
             }
-            if (!myFindModel.isGlobal() && myFindModel.getStringToFind().equals(myEditor.getSelectionModel().getSelectedText())) {
-              myFindModel.setStringToFind("");
+            if (!myFindModel.isGlobal()) {
+              if (myFindModel.getStringToFind().equals(myStartSelectedText)) {
+                myFindModel.setStringToFind("");
+              } else {
+                restoreInitialCaretPositionAndSelection();
+              }
             }
             myIsGlobal = myFindModel.isGlobal();
             myIsReplace = myFindModel.isReplaceState();
@@ -199,9 +199,26 @@ public class EditorSearchSession implements SearchSession,
       }
     }, myDisposable);
 
+    myEditor.getSelectionModel().addSelectionListener(this, myDisposable);
+
     FindUtil.triggerUsedOptionsStats("FindInEditor", findModel);
   }
 
+  private void saveInitialSelection() {
+    if (mySelectionUpdatedFromSearchResults) return;
+    SelectionModel selectionModel = myEditor.getSelectionModel();
+    Document document = myEditor.getDocument();
+    myStartSessionSelectionMarker = document.createRangeMarker(
+      selectionModel.getSelectionStart(),
+      selectionModel.getSelectionEnd()
+    );
+    myStartSessionCaretMarker = document.createRangeMarker(
+      myEditor.getCaretModel().getOffset(),
+      myEditor.getCaretModel().getOffset()
+    );
+    myStartSelectedText = selectionModel.getSelectedText();
+  }
+
   public Editor getEditor() {
     return myEditor;
   }
@@ -278,16 +295,23 @@ public class EditorSearchSession implements SearchSession,
     } else {
       int matches = sr.getMatchesCount();
       boolean tooManyMatches = matches > mySearchResults.getMatchesLimit();
-      myComponent.setStatusText(tooManyMatches
-                                ? ApplicationBundle.message("editorsearch.toomuch", mySearchResults.getMatchesLimit())
-                                : ApplicationBundle.message("editorsearch.matches", matches));
-      myClickToHighlightLabel.setVisible(tooManyMatches);
-      if (!tooManyMatches && matches <= 0) {
-        myComponent.setNotFoundBackground();
-      }
-      else {
+      String status;
+      if (matches == 0 && !sr.getFindModel().isGlobal() && !myEditor.getSelectionModel().hasSelection()) {
+        status = ApplicationBundle.message("editorsearch.noselection");
         myComponent.setRegularBackground();
+      } else {
+        status = tooManyMatches
+                 ? ApplicationBundle.message("editorsearch.toomuch", mySearchResults.getMatchesLimit())
+                 : ApplicationBundle.message("editorsearch.matches", matches);
+        if (!tooManyMatches && matches <= 0) {
+          myComponent.setNotFoundBackground();
+        }
+        else {
+          myComponent.setRegularBackground();
+        }
       }
+      myComponent.setStatusText(status);
+      myClickToHighlightLabel.setVisible(tooManyMatches);
     }
     myComponent.updateActions();
   }
@@ -298,20 +322,11 @@ public class EditorSearchSession implements SearchSession,
   }
 
   @Override
-  public void updateFinished() {
-  }
-
-  @Override
   public void searchFieldDocumentChanged() {
     setMatchesLimit(LivePreviewController.MATCHES_LIMIT);
     String text = myComponent.getSearchTextComponent().getText();
     myFindModel.setStringToFind(text);
-    if (!StringUtil.isEmpty(text)) {
-      updateResults(true);
-    }
-    else {
-      nothingToSearchFor(true);
-    }
+    updateResults(true);
     updateMultiLineStateIfNeeded();
   }
 
@@ -360,9 +375,34 @@ public class EditorSearchSession implements SearchSession,
                        myFindModel.getStringToReplace(),
                        myFindModel.isReplaceState(),
                        myFindModel.isMultiline());
+    updateEmptyText();
     myLivePreviewController.setTrackingSelection(!myFindModel.isGlobal());
   }
 
+  private void updateEmptyText() {
+    if (myComponent.getSearchTextComponent() instanceof ComponentWithEmptyText) {
+      String emptyText = getEmptyText();
+      ((ComponentWithEmptyText)myComponent.getSearchTextComponent()).getEmptyText().setText(emptyText);
+    }
+  }
+
+  @NotNull
+  private String getEmptyText() {
+    if (myFindModel.isGlobal() || !myFindModel.getStringToFind().isEmpty()) return "";
+    String text = getEditor().getSelectionModel().getSelectedText();
+    if (text == null) return "";
+    if (text.contains("\n")) {
+      boolean replaceState = myFindModel.isReplaceState();
+      AnAction action = ActionManager.getInstance().getAction(
+        replaceState ? IdeActions.ACTION_REPLACE : IdeActions.ACTION_FIND);
+      Shortcut shortcut = ArrayUtil.getFirstElement(action.getShortcutSet().getShortcuts());
+      if (shortcut != null) {
+        return ApplicationBundle.message("editorsearch.in.selection.with.hint", KeymapUtil.getShortcutText(shortcut));
+      }
+    }
+    return ApplicationBundle.message("editorsearch.in.selection");
+  }
+
   private static boolean wholeWordsApplicable(String stringToFind) {
     return !stringToFind.startsWith(" ") &&
            !stringToFind.startsWith("\t") &&
@@ -391,7 +431,18 @@ public class EditorSearchSession implements SearchSession,
 
   @Override
   public void selectionChanged(@NotNull SelectionEvent e) {
-    updateResults(false);
+    saveInitialSelection();
+    updateEmptyText();
+  }
+
+  @Override
+  public void beforeSelectionUpdate() {
+    mySelectionUpdatedFromSearchResults = true;
+  }
+
+  @Override
+  public void afterSelectionUpdate() {
+    mySelectionUpdatedFromSearchResults = false;
   }
 
   private void moveCursor(SearchResults.Direction direction) {
@@ -426,16 +477,22 @@ public class EditorSearchSession implements SearchSession,
     else {
 
       if (myFindModel.isRegularExpressions()) {
+        Pattern pattern;
         try {
-          Pattern.compile(text);
+          pattern = Pattern.compile(text);
         }
-        catch (Exception e) {
+        catch (PatternSyntaxException e) {
           myComponent.setNotFoundBackground();
           myClickToHighlightLabel.setVisible(false);
           mySearchResults.clear();
           myComponent.setStatusText(INCORRECT_REGEX_MESSAGE);
           return;
         }
+        if (pattern.matcher("").matches()) {
+          nothingToSearchFor(allowedToChangedEditorSelection);
+          myComponent.setStatusText(ApplicationBundle.message("editorsearch.empty.string.matches"));
+          return;
+        }
       }
 
 
index c523c993f7ae70e5ce3fec44e4c3f38c7e8563bb..6c0c68f66da4e699ef1305322d6fcc90935f8aad 100644 (file)
@@ -85,27 +85,24 @@ public class FindUtil {
   }
 
   public static void configureFindModel(boolean replace, @Nullable Editor editor, FindModel model, boolean firstSearch) {
-    String stringToFind = firstSearch ? "" : model.getStringToFind();
     String selectedText = getSelectedText(editor);
+    boolean multiline = selectedText != null && selectedText.contains("\n");
+    String stringToFind = firstSearch ? "" : model.getStringToFind();
     boolean isSelectionUsed = false;
     if (!StringUtil.isEmpty(selectedText)) {
-      stringToFind = selectedText;
-      isSelectionUsed = true;
+      if (!multiline) {
+        stringToFind = selectedText;
+        isSelectionUsed = true;
+      }
     }
     model.setReplaceState(replace);
-    boolean multiline = stringToFind.contains("\n");
-    boolean isGlobal = true;
-    if (replace && multiline) {
-      isGlobal = false;
-      stringToFind = "";
-      multiline = false;
-    }
+    boolean isGlobal = !multiline;
     model.setStringToFind(isSelectionUsed
                           && model.isRegularExpressions()
                           && Registry.is("ide.find.escape.selected.text.for.regex")
                           ? StringUtil.escapeToRegexp(stringToFind)
                           : stringToFind);
-    model.setMultiline(multiline);
+    model.setMultiline(false);
     model.setGlobal(isGlobal);
     model.setPromptOnReplace(false);
   }
@@ -938,7 +935,7 @@ public class FindUtil {
     PsiElement[] primary = sourceElement == null ? PsiElement.EMPTY_ARRAY : new PsiElement[]{sourceElement};
 
     SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(project);
-    SmartPsiElementPointer[] pointers = Stream.of(targets).map(smartPointerManager::createSmartPsiElementPointer).toArray(SmartPsiElementPointer[]::new);
+    SmartPsiElementPointer<?>[] pointers = Stream.of(targets).map(smartPointerManager::createSmartPsiElementPointer).toArray(SmartPsiElementPointer[]::new);
     // usage view will load document/AST so still referencing all these PSI elements might lead to out of memory
     //noinspection UnusedAssignment
     targets = PsiElement.EMPTY_ARRAY;
index 11e977fe2f7bf1eb1a27d3b7e01f37cb2d0d025d..9fcc92699530a3907066c2e9743636700221eb6c 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.ui.components.panels.Wrapper;
 import com.intellij.ui.mac.TouchbarDataKeys;
 import com.intellij.ui.scale.JBUIScale;
 import com.intellij.ui.speedSearch.SpeedSearchSupply;
+import com.intellij.util.BooleanFunction;
 import com.intellij.util.EventDispatcher;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.ui.JBUI;
@@ -429,9 +430,13 @@ public class SearchReplaceComponent extends EditorHeaderComponent implements Dat
     final MyTextComponentWrapper wrapper = search ? mySearchFieldWrapper : myReplaceFieldWrapper;
 
     final JTextArea textComponent;
-      SearchTextArea textArea = new SearchTextArea(search);
-      textComponent = textArea.getTextArea();
-      textComponent.setRows(isMultiline() ? 2 : 1);
+    SearchTextArea textArea = new SearchTextArea(search);
+    textComponent = textArea.getTextArea();
+    textComponent.setFont(myTargetComponent.getFont());
+    textComponent.setRows(isMultiline() ? 2 : 1);
+    // Display empty text only when focused
+    textComponent.putClientProperty(
+      "StatusVisibleFunction", (BooleanFunction<JTextComponent>)(c -> c.getText().isEmpty() && c.isFocusOwner()));
 
     wrapper.setContent(textArea);
 
index 57efe9e7fb0e806b82ec8db34bde52124acea1b6..1a5ee9919a2c3c7bec6f70d621806f8a4060bed3 100644 (file)
@@ -43,13 +43,17 @@ public abstract class OccurrenceAction extends DumbAwareAction implements Shortc
     boolean visible = !search.getFindModel().isReplaceState() || availableForReplace();
     boolean hasMatches = search.hasMatches();
     e.getPresentation().setVisible(visible);
-    e.getPresentation().setEnabled(visible && hasMatches);
+    e.getPresentation().setEnabled(visible && hasMatches && (availableForSelection() || search.getFindModel().isGlobal()));
   }
 
   protected boolean availableForReplace() {
     return false;
   }
 
+  protected boolean availableForSelection() {
+    return false;
+  }
+
   @Nullable
   @Override
   public ShortcutSet getShortcut() {
index 9e0e01c6f73becc74799e7b870c8b056b25525e7..61df340dbbb4f0de79c3bd07d60c429e3ad2b72b 100644 (file)
@@ -23,6 +23,11 @@ public class SelectAllAction extends OccurrenceAction {
   }
 
   @Override
+  protected boolean availableForSelection() {
+    return true;
+  }
+
+  @Override
   public void actionPerformed(@NotNull AnActionEvent e) {
     EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
     search.selectAllOccurrences();
index cf89168fc9eb88a964eb8e492b62a52c7c5bdacf..65d26db19397d5296adabbf22dd4442711ccb825 100644 (file)
@@ -2,8 +2,10 @@ package com.intellij.find.editorHeaderActions;
 
 import com.intellij.find.EditorSearchSession;
 import com.intellij.find.FindModel;
-import com.intellij.find.FindUtil;
-import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.editor.actionSystem.EditorAction;
 import com.intellij.openapi.keymap.KeymapUtil;
 import com.intellij.openapi.project.DumbAware;
@@ -46,7 +48,8 @@ public class SwitchToFind extends AnAction implements DumbAware {
     }
 
     final FindModel findModel = search.getFindModel();
-    FindUtil.configureFindModel(false, e.getData(CommonDataKeys.EDITOR), findModel, false);
+    if (!findModel.isReplaceState()) return;
+    findModel.setReplaceState(false);
     search.getComponent().getSearchTextComponent().selectAll();
   }
 }
index 674c1cc03aa7e037a8e2c32976c80b44982531ce..dc7714a87a1d1f0a0ae5c8a7aa7a175c2ac25400 100644 (file)
@@ -3,7 +3,6 @@ package com.intellij.find.editorHeaderActions;
 import com.intellij.execution.impl.ConsoleViewUtil;
 import com.intellij.find.EditorSearchSession;
 import com.intellij.find.FindModel;
-import com.intellij.find.FindUtil;
 import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -32,7 +31,8 @@ public class SwitchToReplace extends AnAction {
   public void actionPerformed(@NotNull AnActionEvent e) {
     EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
     FindModel findModel = search.getFindModel();
-    FindUtil.configureFindModel(true, e.getData(CommonDataKeys.EDITOR), findModel, false);
+    if (findModel.isReplaceState()) return;
+    findModel.setReplaceState(true);
     search.getComponent().getSearchTextComponent().selectAll();
   }
 }
index f4b21dde87187b869808948460e356eff3daccd7..b293e767749112352a6888c01e032da8385dca94 100644 (file)
@@ -1,30 +1,43 @@
 package com.intellij.find.editorHeaderActions;
 
-import com.intellij.find.EditorSearchSession;
 import com.intellij.find.SearchSession;
-import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.keymap.KeymapUtil;
+import com.intellij.openapi.project.DumbAware;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
-public class ToggleSelectionOnlyAction extends EditorHeaderToggleAction {
+public class ToggleSelectionOnlyAction extends ToggleAction implements ContextAwareShortcutProvider, DumbAware {
   public ToggleSelectionOnlyAction() {
-    super("In &Selection");
+    super("In Selection", "Search in selection only", AllIcons.Actions.InSelection);
   }
 
   @Override
-  public void update(@NotNull AnActionEvent e) {
-    super.update(e);
-
-    EditorSearchSession session = e.getData(EditorSearchSession.SESSION_KEY);
-    e.getPresentation().setEnabledAndVisible(session != null && session.getFindModel().isReplaceState());
+  public boolean isSelected(@NotNull AnActionEvent e) {
+    SearchSession search = e.getData(SearchSession.KEY);
+    return search != null && !search.getFindModel().isGlobal();
   }
 
   @Override
-  protected boolean isSelected(@NotNull SearchSession session) {
-    return !session.getFindModel().isGlobal();
+  public void setSelected(@NotNull AnActionEvent e, boolean state) {
+    SearchSession search = e.getData(SearchSession.KEY);
+    if (search != null) {
+      search.getFindModel().setGlobal(!state);
+    }
   }
 
+  @Nullable
   @Override
-  protected void setSelected(@NotNull SearchSession session, boolean selected) {
-    session.getFindModel().setGlobal(!selected);
+  public ShortcutSet getShortcut(@NotNull DataContext context) {
+    if (KeymapUtil.isEmacsKeymap()) return null;
+    SearchSession search = context.getData(SearchSession.KEY);
+    if (search != null) {
+      boolean replaceState = search.getFindModel().isReplaceState();
+      AnAction action = ActionManager.getInstance().getAction(
+        replaceState ? IdeActions.ACTION_REPLACE : IdeActions.ACTION_FIND);
+      return action != null ? action.getShortcutSet() : null;
+    }
+    return null;
   }
 }
index 03b1aa571917dcd040cf5f1724589b272e4ff387..e85dc8500dcd16c44264bd79ebdf2f39486e3225 100644 (file)
@@ -139,7 +139,9 @@ public class SearchResults implements DocumentListener {
     void searchResultsUpdated(@NotNull SearchResults sr);
     void cursorMoved();
 
-    void updateFinished();
+    default void updateFinished() {}
+    default void beforeSelectionUpdate() {}
+    default void afterSelectionUpdate() {}
   }
   public void addListener(@NotNull SearchResultsListener srl) {
     myListeners.add(srl);
@@ -331,14 +333,28 @@ public class SearchResults implements DocumentListener {
     notifyChanged();
     if (myCursor == null || !myCursor.equals(oldCursorRange)) {
       if (toChangeSelection) {
-        mySelectionManager.updateSelection(true, true);
+        updateSelection(true, true);
       }
       notifyCursorMoved();
     }
-    dumpIfNeeded();
+    notifyUpdateFinished();
   }
 
-  private void dumpIfNeeded() {
+  private void updateSelection(boolean removePreviousSelection, boolean removeAllPreviousSelections) {
+    for (SearchResultsListener listener : myListeners) {
+      listener.beforeSelectionUpdate();
+    }
+    try {
+      mySelectionManager.updateSelection(removePreviousSelection, removeAllPreviousSelections);
+    }
+    finally {
+      for (SearchResultsListener listener : myListeners) {
+        listener.afterSelectionUpdate();
+      }
+    }
+  }
+
+  private void notifyUpdateFinished() {
     for (SearchResultsListener listener : myListeners) {
       listener.updateFinished();
     }
@@ -608,7 +624,7 @@ public class SearchResults implements DocumentListener {
     if (next != null && !mySelectionManager.isSelected(next)) {
       retainOldSelection &= myCursor != null && mySelectionManager.isSelected(myCursor);
       myCursor = next;
-      mySelectionManager.updateSelection(!retainOldSelection, false);
+      updateSelection(!retainOldSelection, false);
       notifyCursorMoved();
     }
   }
index abebf632afc39bea612a5d508b338125d3c9385d..988e0abfba50940079c944c515ed6f6f9c549d67 100644 (file)
@@ -812,6 +812,10 @@ code.style.indent.provider.notification.settings=Code Style Settings
 
 editorsearch.matches={0, choice, 0#No matches|1#One match|2#{0} matches}
 editorsearch.toomuch=More than {0} matches
+editorsearch.noselection=No selection
+editorsearch.empty.string.matches=Regular expression matches an empty string
+editorsearch.in.selection=Search in selection
+editorsearch.in.selection.with.hint=Search in selection. {0} to search for selected text
 code.style.other.file.types=Other File Types
 code.style.other.label=Text files and unsupported file types\: