From 7c5866059d41c288a6b4cf8bd9e2a6b5318405e8 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 19 Jun 2024 12:48:43 +0200 Subject: [PATCH] Don't highlight when selection contains line break (IJPL-45173) for "Highlight occurrences of selected text" GitOrigin-RevId: 8a79a4b0212a711739c6532dd70afd917d20aa9b --- .../codeInsight/highlighting/BackgroundHighlighter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BackgroundHighlighter.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BackgroundHighlighter.java index 4272ed9330a6..1d95fca9a478 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BackgroundHighlighter.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BackgroundHighlighter.java @@ -190,7 +190,7 @@ final class BackgroundHighlighter { int end = caret.getSelectionEnd(); CharSequence sequence = document.getCharsSequence(); String toFind = sequence.subSequence(start, end).toString(); - if (toFind.trim().isEmpty()) { + if (toFind.trim().isEmpty() || toFind.contains("\n")) { return false; } String previous = editor.getUserData(HIGHLIGHTED_TEXT);