mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
Only highlight case-sensitively or by word if editor search session is open (IDEA-98569)
GitOrigin-RevId: 877fef720bfedb09edb12080dd4d61084e7627b8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4a5fb73b18
commit
25fc90c770
@@ -9,6 +9,7 @@ import com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory;
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
import com.intellij.codeInsight.template.TemplateEditingAdapter;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.find.EditorSearchSession;
|
||||
import com.intellij.find.FindManager;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.find.FindResult;
|
||||
@@ -159,7 +160,7 @@ final class BackgroundHighlighter {
|
||||
}
|
||||
|
||||
private static void highlightSelection(@NotNull Project project, @NotNull Editor editor) {
|
||||
if (!Registry.is("editor.highlight.selected.text.occurrences")) {
|
||||
if (!Registry.is("editor.highlight.selected.text.occurrences") || !CodeInsightSettings.getInstance().HIGHLIGHT_IDENTIFIER_UNDER_CARET) {
|
||||
return;
|
||||
}
|
||||
ThreadingAssertions.assertEventDispatchThread();
|
||||
@@ -194,13 +195,15 @@ final class BackgroundHighlighter {
|
||||
if (toFind.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FindManager findManager = FindManager.getInstance(project);
|
||||
FindModel findModel = new FindModel();
|
||||
EditorSearchSession editorSearchSession = EditorSearchSession.get(editor);
|
||||
if (editorSearchSession != null) {
|
||||
findModel.copyFrom(findManager.getFindInFileModel());
|
||||
}
|
||||
findModel.setRegularExpressions(false);
|
||||
findModel.setStringToFind(toFind);
|
||||
ReadAction.nonBlocking(() -> {
|
||||
FindManager findManager = FindManager.getInstance(project);
|
||||
FindModel findInFileModel = findManager.getFindInFileModel();
|
||||
FindModel findModel = new FindModel();
|
||||
findModel.copyFrom(findInFileModel);
|
||||
findModel.setRegularExpressions(false);
|
||||
findModel.setStringToFind(toFind);
|
||||
int offset = 0;
|
||||
FindResult result = findManager.findString(sequence, offset, findModel, null);
|
||||
List<FindResult> results = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user