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 2009/10/13 14:40:18 UTC

svn commit: r824722 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java

Author: gbrown
Date: Tue Oct 13 12:40:17 2009
New Revision: 824722

URL: http://svn.apache.org/viewvc?rev=824722&view=rev
Log:
Resolve issue PIVOT-325.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=824722&r1=824721&r2=824722&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java Tue Oct 13 12:40:17 2009
@@ -1215,15 +1215,25 @@
 
             textInput.setSelection(selectionStart, selectionLength);
         } else if (keyCode == Keyboard.KeyCode.HOME) {
-            consumed = true;
-
             // Move the caret to the beginning of the text
-            textInput.setSelection(0, 0);
-        } else if (keyCode == Keyboard.KeyCode.END) {
-            consumed = true;
+            if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
+                textInput.setSelection(0, textInput.getSelectionStart());
+            } else {
+                textInput.setSelection(0, 0);
+            }
 
+            consumed = true;
+        } else if (keyCode == Keyboard.KeyCode.END) {
             // Move the caret to the end of the text
-            textInput.setSelection(textNode.getCharacterCount(), 0);
+            if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
+                int selectionStart = textInput.getSelectionStart();
+                textInput.setSelection(selectionStart, textNode.getCharacterCount()
+                    - selectionStart);
+            } else {
+                textInput.setSelection(textNode.getCharacterCount(), 0);
+            }
+
+            consumed = true;
         } else if (keyCode == Keyboard.KeyCode.A
             && Keyboard.isPressed(commandModifier)) {
             consumed = true;