From dd712b65354f3f0331cecb7a9cddd5b769f2ef9d Mon Sep 17 00:00:00 2001 From: Filipp Vakhitov Date: Tue, 7 Feb 2023 14:14:56 +0200 Subject: [PATCH] IDEA-110607 Double clicking space/tab characters should select all space/tab characters until it encounters another type of character Better `Extend Selection` behavior when some text is already selected GitOrigin-RevId: ca57c876f49590eb6693b3e1cc7a832e758a88db --- .../com/intellij/codeInsight/editorActions/SelectWordUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java index b5d9dbd64e25..c469d6400a2c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java @@ -271,6 +271,8 @@ public final class SelectWordUtil { * by any side of a caret at specified cursorPosition */ public static boolean canWhiteSpaceBeExpanded(PsiWhiteSpace psiWhiteSpace, int cursorPosition, Caret caret) { + if (caret.hasSelection() && psiWhiteSpace.getTextRange().contains(caret.getSelectionRange())) return false; + int beforeOffset = caret.hasSelection()? caret.getSelectionStart() : cursorPosition; Character charBeforeCursor = getCharBeforeCursorInPsiElement(psiWhiteSpace, beforeOffset); if (charBeforeCursor != null && isExpandableWhiteSpace(charBeforeCursor)) return true;