You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/12/04 14:21:04 UTC
svn commit: r1042170 -
/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Author: gbrown
Date: Sat Dec 4 13:21:04 2010
New Revision: 1042170
URL: http://svn.apache.org/viewvc?rev=1042170&view=rev
Log:
Ignore Enter keypress in TextArea if modifiers are pressed.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=1042170&r1=1042169&r2=1042170&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Sat Dec 4 13:21:04 2010
@@ -845,13 +845,15 @@ public class TextAreaSkin extends Compon
Keyboard.Modifier wordNavigationModifier = Platform.getWordNavigationModifier();
if (keyCode == Keyboard.KeyCode.ENTER
- && textArea.isEditable()) {
+ && textArea.isEditable()
+ && Keyboard.getModifiers() == 0) {
int index = textArea.getSelectionStart();
textArea.removeText(index, textArea.getSelectionLength());
textArea.insertText("\n", index);
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.DELETE) {
+ } else if (keyCode == Keyboard.KeyCode.DELETE
+ && textArea.isEditable()) {
int index = textArea.getSelectionStart();
if (index < textArea.getCharacterCount()) {
@@ -860,7 +862,8 @@ public class TextAreaSkin extends Compon
consumed = true;
}
- } else if (keyCode == Keyboard.KeyCode.BACKSPACE) {
+ } else if (keyCode == Keyboard.KeyCode.BACKSPACE
+ && textArea.isEditable()) {
int index = textArea.getSelectionStart();
int count = textArea.getSelectionLength();
@@ -873,7 +876,8 @@ public class TextAreaSkin extends Compon
consumed = true;
}
} else if (keyCode == Keyboard.KeyCode.TAB
- && Keyboard.isPressed(Keyboard.Modifier.CTRL)) {
+ && Keyboard.isPressed(Keyboard.Modifier.CTRL)
+ && textArea.isEditable()) {
int selectionLength = textArea.getSelectionLength();
StringBuilder tabBuilder = new StringBuilder();
@@ -890,6 +894,8 @@ public class TextAreaSkin extends Compon
}
showCaret(true);
+
+ consumed = true;
} else if (keyCode == Keyboard.KeyCode.HOME
|| (keyCode == Keyboard.KeyCode.LEFT
&& Keyboard.isPressed(Keyboard.Modifier.META))) {