mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-63313 CamelHump immediately after digit is not taken into account
1. Corrected 'camel humps' selection when target work contains digit just before the 'hump'; 2. Corresponding test is added;
This commit is contained in:
+6
-2
@@ -165,9 +165,9 @@ public class EditorActionUtil {
|
||||
|
||||
if (isCamel) {
|
||||
if (firstIsIdentifierPart && secondIsIdentifierPart &&
|
||||
(Character.isLowerCase(prev) && Character.isUpperCase(current) ||
|
||||
(isLowerCaseOrDigit(prev) && Character.isUpperCase(current) ||
|
||||
prev == '_' && current != '_' ||
|
||||
Character.isUpperCase(prev) && Character.isUpperCase(current) && Character.isLowerCase(next))) {
|
||||
Character.isUpperCase(prev) && Character.isUpperCase(current) && isLowerCaseOrDigit(next))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,10 @@ public class EditorActionUtil {
|
||||
return (Character.isWhitespace(prev) || firstIsIdentifierPart) &&
|
||||
!Character.isWhitespace(current) && !secondIsIdentifierPart;
|
||||
}
|
||||
|
||||
private static boolean isLowerCaseOrDigit(char c) {
|
||||
return Character.isLowerCase(c) || Character.isDigit(c);
|
||||
}
|
||||
|
||||
public static boolean isWordEnd(CharSequence text, int offset, boolean isCamel) {
|
||||
char prev = offset > 0 ? text.charAt(offset - 1) : 0;
|
||||
|
||||
+8
@@ -492,6 +492,14 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
|
||||
doAction(IdeActions.ACTION_EDITOR_PASTE);
|
||||
}
|
||||
|
||||
protected static void moveCaretToPreviousWordWithSelection() {
|
||||
doAction("EditorPreviousWordWithSelection");
|
||||
}
|
||||
|
||||
protected static void moveCaretToNextWordWithSelection() {
|
||||
doAction("EditorNextWordWithSelection");
|
||||
}
|
||||
|
||||
protected static void lineComment() {
|
||||
new CommentByLineCommentHandler().invoke(getProject(), getEditor(), getFile());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user