diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndAction.java
index 093e7dac6c5d..92c8317847de 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndAction.java
@@ -32,27 +32,38 @@ import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler;
public class DeleteToWordEndAction extends TextComponentEditorAction {
public DeleteToWordEndAction() {
- super(new Handler());
+ super(new Handler(false));
}
- private static class Handler extends EditorWriteActionHandler {
+ static class Handler extends EditorWriteActionHandler {
+
+ private final boolean myNegateCamelMode;
+
+ Handler(boolean negateCamelMode) {
+ myNegateCamelMode = negateCamelMode;
+ }
+
@Override
public void executeWriteAction(Editor editor, DataContext dataContext) {
CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP);
- deleteToWordEnd(editor);
+ boolean camelMode = editor.getSettings().isCamelWords();
+ if (myNegateCamelMode) {
+ camelMode = !camelMode;
+ }
+ deleteToWordEnd(editor, camelMode);
}
}
- private static void deleteToWordEnd(Editor editor) {
+ private static void deleteToWordEnd(Editor editor, boolean camelMode) {
int startOffset = editor.getCaretModel().getOffset();
- int endOffset = getWordEndOffset(editor, startOffset);
+ int endOffset = getWordEndOffset(editor, startOffset, camelMode);
if(endOffset > startOffset) {
Document document = editor.getDocument();
document.deleteString(startOffset, endOffset);
}
}
- private static int getWordEndOffset(Editor editor, int offset) {
+ private static int getWordEndOffset(Editor editor, int offset, boolean camelMode) {
Document document = editor.getDocument();
CharSequence text = document.getCharsSequence();
if(offset >= document.getTextLength() - 1)
@@ -65,10 +76,9 @@ public class DeleteToWordEndAction extends TextComponentEditorAction {
return offset;
maxOffset = document.getLineEndOffset(lineNumber+1);
}
- boolean camel = editor.getSettings().isCamelWords();
for (; newOffset < maxOffset; newOffset++) {
- if (EditorActionUtil.isWordEnd(text, newOffset, camel) ||
- EditorActionUtil.isWordStart(text, newOffset, camel)) {
+ if (EditorActionUtil.isWordEnd(text, newOffset, camelMode) ||
+ EditorActionUtil.isWordStart(text, newOffset, camelMode)) {
break;
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndInDifferentHumpsModeAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndInDifferentHumpsModeAction.java
new file mode 100644
index 000000000000..f11839746b82
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordEndInDifferentHumpsModeAction.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor.actions;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/14/13 7:35 PM
+ */
+public class DeleteToWordEndInDifferentHumpsModeAction extends TextComponentEditorAction {
+
+ public DeleteToWordEndInDifferentHumpsModeAction() {
+ super(new DeleteToWordEndAction.Handler(true));
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartAction.java
index 74826fbebef7..cc8399ac2e29 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartAction.java
@@ -65,13 +65,18 @@ public class DeleteToWordStartAction extends TextComponentEditorAction {
private static final int[] QUOTE_SYMBOLS_ARRAY = QUOTE_SYMBOLS.toArray();
public DeleteToWordStartAction() {
- super(new Handler());
+ super(new Handler(false));
}
- private static class Handler extends EditorWriteActionHandler {
+ static class Handler extends EditorWriteActionHandler {
@NotNull private final TIntIntHashMap myQuotesNumber = new TIntIntHashMap();
-
+ private final boolean myNegateCamelMode;
+
+ Handler(boolean negateCamelMode) {
+ myNegateCamelMode = negateCamelMode;
+ }
+
@Override
public void executeWriteAction(Editor editor, DataContext dataContext) {
CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP);
@@ -79,6 +84,10 @@ public class DeleteToWordStartAction extends TextComponentEditorAction {
}
private void deleteToWordStart(Editor editor) {
+ boolean camel = editor.getSettings().isCamelWords();
+ if (myNegateCamelMode) {
+ camel = !camel;
+ }
CharSequence text = editor.getDocument().getCharsSequence();
CaretModel caretModel = editor.getCaretModel();
int endOffset = caretModel.getOffset();
@@ -90,7 +99,7 @@ public class DeleteToWordStartAction extends TextComponentEditorAction {
}
countQuotes(myQuotesNumber, text, minOffset, endOffset);
- EditorActionUtil.moveCaretToPreviousWord(editor, false);
+ EditorActionUtil.moveCaretToPreviousWord(editor, false, camel);
for (int offset = caretModel.getOffset(); offset > minOffset; offset = caretModel.getOffset()) {
char previous = text.charAt(offset - 1);
@@ -106,7 +115,7 @@ public class DeleteToWordStartAction extends TextComponentEditorAction {
}
if (myQuotesNumber.get(current) % 2 == 0) {
// Was 'one "two" [caret]', now 'one "two[caret]"', we want to get 'one [caret]"two"'
- EditorActionUtil.moveCaretToPreviousWord(editor, false);
+ EditorActionUtil.moveCaretToPreviousWord(editor, false, camel);
continue;
}
break;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartInDifferentHumpsModeAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartInDifferentHumpsModeAction.java
new file mode 100644
index 000000000000..f05bc0b0ea49
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartInDifferentHumpsModeAction.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor.actions;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/14/13 7:31 PM
+ */
+public class DeleteToWordStartInDifferentHumpsModeAction extends TextComponentEditorAction {
+
+ public DeleteToWordStartInDifferentHumpsModeAction() {
+ super(new DeleteToWordStartAction.Handler(true));
+ }
+}
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 b01d2bef3d8d..0aa6571e4727 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
@@ -569,7 +569,7 @@ public class EditorActionUtil {
setupSelection(editor, isWithSelection, selectionStart, blockSelectionStart);
}
- public static void moveCaretToNextWord(Editor editor, boolean isWithSelection) {
+ public static void moveCaretToNextWord(Editor editor, boolean isWithSelection, boolean camel) {
Document document = editor.getDocument();
SelectionModel selectionModel = editor.getSelectionModel();
int selectionStart = selectionModel.getLeadSelectionOffset();
@@ -593,7 +593,6 @@ public class EditorActionUtil {
}
maxOffset = document.getLineEndOffset(lineNumber + 1);
}
- boolean camel = editor.getSettings().isCamelWords();
for (; newOffset < maxOffset; newOffset++) {
if (isWordStart(text, newOffset, camel)) {
break;
@@ -651,7 +650,7 @@ public class EditorActionUtil {
editor.putUserData(PREV_POS, pos);
}
- public static void moveCaretToPreviousWord(Editor editor, boolean isWithSelection) {
+ public static void moveCaretToPreviousWord(Editor editor, boolean isWithSelection, boolean camel) {
Document document = editor.getDocument();
SelectionModel selectionModel = editor.getSelectionModel();
int selectionStart = selectionModel.getLeadSelectionOffset();
@@ -667,7 +666,6 @@ public class EditorActionUtil {
CharSequence text = document.getCharsSequence();
int newOffset = offset - 1;
int minOffset = lineNumber > 0 ? document.getLineEndOffset(lineNumber - 1) : 0;
- boolean camel = editor.getSettings().isCamelWords();
for (; newOffset > minOffset; newOffset--) {
if (isWordStart(text, newOffset, camel)) break;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordAction.java
index 530b745f546e..4c356228c546 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordAction.java
@@ -37,7 +37,7 @@ public class NextWordAction extends TextComponentEditorAction {
private static class Handler extends EditorActionHandler {
@Override
public void execute(Editor editor, DataContext dataContext) {
- EditorActionUtil.moveCaretToNextWord(editor, false);
+ EditorActionUtil.moveCaretToNextWord(editor, false, editor.getSettings().isCamelWords());
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordInDifferentHumpsModeAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordInDifferentHumpsModeAction.java
new file mode 100644
index 000000000000..d0fb2bcc363d
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordInDifferentHumpsModeAction.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor.actions;
+
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/14/13 7:22 PM
+ */
+public class NextWordInDifferentHumpsModeAction extends TextComponentEditorAction {
+
+ public NextWordInDifferentHumpsModeAction() {
+ super(new Handler());
+ }
+
+ private static class Handler extends EditorActionHandler {
+ @Override
+ public void execute(Editor editor, DataContext dataContext) {
+ EditorActionUtil.moveCaretToNextWord(editor, false, !editor.getSettings().isCamelWords());
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordInDifferentHumpsModeWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordInDifferentHumpsModeWithSelectionAction.java
new file mode 100644
index 000000000000..bf1c4da5ae61
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordInDifferentHumpsModeWithSelectionAction.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor.actions;
+
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/14/13 7:23 PM
+ */
+public class NextWordInDifferentHumpsModeWithSelectionAction extends TextComponentEditorAction {
+
+ public NextWordInDifferentHumpsModeWithSelectionAction() {
+ super(new Handler());
+ }
+
+ private static class Handler extends EditorActionHandler {
+ @Override
+ public void execute(Editor editor, DataContext dataContext) {
+ EditorActionUtil.moveCaretToNextWord(editor, true, !editor.getSettings().isCamelWords());
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordWithSelectionAction.java
index b80a56a48eee..8967c0e321ec 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordWithSelectionAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/NextWordWithSelectionAction.java
@@ -37,7 +37,7 @@ public class NextWordWithSelectionAction extends TextComponentEditorAction {
private static class Handler extends EditorActionHandler {
@Override
public void execute(Editor editor, DataContext dataContext) {
- EditorActionUtil.moveCaretToNextWord(editor, true);
+ EditorActionUtil.moveCaretToNextWord(editor, true, editor.getSettings().isCamelWords());
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordAction.java
index 7c030eb078fe..cf423d969ff4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordAction.java
@@ -37,7 +37,7 @@ public class PreviousWordAction extends TextComponentEditorAction {
private static class Handler extends EditorActionHandler {
@Override
public void execute(Editor editor, DataContext dataContext) {
- EditorActionUtil.moveCaretToPreviousWord(editor, false);
+ EditorActionUtil.moveCaretToPreviousWord(editor, false, editor.getSettings().isCamelWords());
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordInDifferentHumpsModeAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordInDifferentHumpsModeAction.java
new file mode 100644
index 000000000000..d5debd14cf2f
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordInDifferentHumpsModeAction.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor.actions;
+
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/14/13 7:24 PM
+ */
+public class PreviousWordInDifferentHumpsModeAction extends TextComponentEditorAction {
+
+ public PreviousWordInDifferentHumpsModeAction() {
+ super(new Handler());
+ }
+
+ private static class Handler extends EditorActionHandler {
+ @Override
+ public void execute(Editor editor, DataContext dataContext) {
+ EditorActionUtil.moveCaretToPreviousWord(editor, false, !editor.getSettings().isCamelWords());
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordInDifferentHumpsModeWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordInDifferentHumpsModeWithSelectionAction.java
new file mode 100644
index 000000000000..c6b4f2eea2a8
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordInDifferentHumpsModeWithSelectionAction.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.editor.actions;
+
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/14/13 7:27 PM
+ */
+public class PreviousWordInDifferentHumpsModeWithSelectionAction extends TextComponentEditorAction {
+
+ public PreviousWordInDifferentHumpsModeWithSelectionAction() {
+ super(new Handler());
+ }
+
+ private static class Handler extends EditorActionHandler {
+ @Override
+ public void execute(Editor editor, DataContext dataContext) {
+ EditorActionUtil.moveCaretToPreviousWord(editor, true, !editor.getSettings().isCamelWords());
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordWithSelectionAction.java
index bb57812c8508..c1e38172a802 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordWithSelectionAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PreviousWordWithSelectionAction.java
@@ -38,7 +38,7 @@ public class PreviousWordWithSelectionAction extends TextComponentEditorAction {
private static class Handler extends EditorActionHandler {
@Override
public void execute(Editor editor, DataContext dataContext) {
- EditorActionUtil.moveCaretToPreviousWord(editor, true);
+ EditorActionUtil.moveCaretToPreviousWord(editor, true, editor.getSettings().isCamelWords());
}
}
}
diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties
index c2c4164a530c..22ea98e140ed 100644
--- a/platform/platform-resources-en/src/messages/ActionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties
@@ -117,16 +117,22 @@ action.EditorLineEndWithSelection.text=Move Caret to Line End with Selection
action.EditorTextStartWithSelection.text=Move Caret to Text Start with Selection
action.EditorTextEndWithSelection.text=Move Caret to Text End with Selection
action.EditorNextWord.text=Move Caret to Next Word
+action.EditorNextWordInDifferentHumpsMode.text=Move Caret to Next Word in Different "CamelHumps" Mode
action.EditorPreviousWord.text=Move Caret to Previous Word
+action.EditorPreviousWordInDifferentHumpsMode.text=Move Caret to Previous Word in Different "CamelHumps" Mode
action.EditorNextWordWithSelection.text=Move Caret to Next Word with Selection
+action.EditorNextWordInDifferentHumpsModeWithSelection.text=Move Caret to Next Word with Selection in Different "CamelHumps" Mode
action.EditorPreviousWordWithSelection.text=Move Caret to Previous Word with Selection
+action.EditorPreviousWordInDifferentHumpsModeWithSelection.text=Move Caret to Previous Word with Selection in Different "CamelHumps" Mode
action.EditorCodeBlockStart.text=Move Caret to Code Block Start
action.EditorCodeBlockEnd.text=Move Caret to Code Block End
action.EditorCodeBlockStartWithSelection.text=Move Caret to Code Block Start with Selection
action.EditorCodeBlockEndWithSelection.text=Move Caret to Code Block End with Selection
action.EditorMatchBrace.text=Move Caret to Matched Brace
action.EditorDeleteToWordStart.text=Delete to Word Start
+action.EditorDeleteToWordStartInDifferentHumpsMode.text=Delete to Word Start in Different "CamelHumps" Mode
action.EditorDeleteToWordEnd.text=Delete to Word End
+action.EditorDeleteToWordEndInDifferentHumpsMode.text=Delete to Word End in Different "CamelHumps" Mode
action.EditorDeleteLine.text=Delete Line
action.EditorKillToWordStart.text=Kill to Word Start
action.EditorKillToWordEnd.text=Kill to Word End
diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml
index 6fe7bd8f2a1f..552e377773ca 100644
--- a/platform/platform-resources/src/idea/PlatformActions.xml
+++ b/platform/platform-resources/src/idea/PlatformActions.xml
@@ -86,11 +86,17 @@
-
+
+
+
+
+
+
+