mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: fix Extend Selection on empty text block (IDEA-372040)
GitOrigin-RevId: a47f4128f616b8b4921b81708daaa1839f0fa3f2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
49ace10031
commit
5782ec13a0
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.editorActions.wordSelection;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.SelectWordUtil;
|
||||
@@ -72,12 +72,12 @@ public final class LiteralSelectioner extends AbstractBasicBackBasicSelectioner
|
||||
for (; end >= start; end--) {
|
||||
char c = text.charAt(end);
|
||||
if (c == '\n' || !Character.isWhitespace(c)) {
|
||||
end += 1;
|
||||
end++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new TextRange(start, end);
|
||||
return end < start ? range : new TextRange(start, end);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
+1
@@ -94,6 +94,7 @@ public abstract class AbstractBasicJavaSelectWordTest extends SelectWordTestBase
|
||||
public void testTextBlockEscapedLineEndings() { doTest("java"); }
|
||||
public void testTextBlockLeadingWhitespace() { doTest("java"); }
|
||||
public void testUnclosedTextBlock() { doTest("java"); }
|
||||
public void testEmptyTextBlock() { doTest("java"); }
|
||||
public void testUnclosedLiteral() { doTest("java"); }
|
||||
|
||||
public void testStringTemplate1() { doTest("java"); }
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class X {{
|
||||
String s = <selection>"<caret>""
|
||||
"""</selection>;
|
||||
}}
|
||||
@@ -0,0 +1,4 @@
|
||||
class X {{
|
||||
<selection> String s = "<caret>""
|
||||
""";
|
||||
</selection>}}
|
||||
@@ -0,0 +1,4 @@
|
||||
class X {{
|
||||
String s = "<caret>""
|
||||
""";
|
||||
}}
|
||||
Reference in New Issue
Block a user