diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java index ecdaca94248f..a3f1a005670d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java @@ -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; diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java index 298b52ea9311..9f8487354b82 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java @@ -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()); }