You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2018/02/08 23:40:35 UTC

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

Author: rwhitcomb
Date: Thu Feb  8 23:40:35 2018
New Revision: 1823611

URL: http://svn.apache.org/viewvc?rev=1823611&view=rev
Log:
PIVOT-891:  Refine the definition of "word" in TextInput to be a UnicodeIdenfierPart
(according to the Character classification), and make the word-navigation correspond
to the mouse double-click logic.

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

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=1823611&r1=1823610&r2=1823611&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java Thu Feb  8 23:40:35 2018
@@ -1180,12 +1180,12 @@ public class TerraTextInputSkin extends
                 selectionLength++;
             } while (selectionStart + selectionLength < length
                 && Character.isWhitespace(textInput.getCharacterAt(selectionStart + selectionLength)));
-        } else if (Character.isJavaIdentifierPart(ch)) {
+        } else if (Character.isUnicodeIdentifierPart(ch)) {
             // Move backward to beginning of identifier block
             do {
                 selectionStart--;
             } while (selectionStart >= 0
-                && Character.isJavaIdentifierPart(textInput.getCharacterAt(selectionStart)));
+                && Character.isUnicodeIdentifierPart(textInput.getCharacterAt(selectionStart)));
             selectionStart++;
             selectionLength = start - selectionStart;
             // Move forward to end of identifier block
@@ -1367,10 +1367,16 @@ public class TerraTextInputSkin extends
                         wordStart--;
                     }
 
-                    // Skip over any word-letters to the left
-                    while (wordStart > 0
-                        && !Character.isWhitespace(textInput.getCharacterAt(wordStart - 1))) {
-                        wordStart--;
+                    // Skip over any word-letters to the left, or just skip one character for other stuff
+                    if (wordStart > 0) {
+                        if (Character.isUnicodeIdentifierPart(textInput.getCharacterAt(wordStart - 1))) {
+                            while (wordStart > 0
+                                && Character.isUnicodeIdentifierPart(textInput.getCharacterAt(wordStart - 1))) {
+                                wordStart--;
+                            }
+                        } else {
+                            wordStart--;
+                        }
                     }
 
                     if (isShiftPressed) {
@@ -1460,10 +1466,16 @@ public class TerraTextInputSkin extends
                         wordStart++;
                     }
 
-                    // Skip over any word-letters to the right
-                    while (wordStart < textInput.getCharacterCount()
-                        && !Character.isWhitespace(textInput.getCharacterAt(wordStart))) {
-                        wordStart++;
+                    // Skip over any word-letters to the right, or move one character for other stuff
+                    if (wordStart < textInput.getCharacterCount()) {
+                        if (Character.isUnicodeIdentifierPart(textInput.getCharacterAt(wordStart))) {
+                            while (wordStart < textInput.getCharacterCount()
+                                && Character.isUnicodeIdentifierPart(textInput.getCharacterAt(wordStart))) {
+                                wordStart++;
+                            }
+                        } else {
+                            wordStart++;
+                        }
                     }
 
                     if (isShiftPressed) {