changeset 6521:54d4f4b10dec

RT-34973: TextArea: the next line is selected when triple clicking the last word of a line.
author leifs
date Wed, 19 Mar 2014 15:46:11 -0700
parents 6b8ba389829c
children 27df155347e9
files modules/controls/src/main/java/javafx/scene/control/TextInputControl.java
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/control/TextInputControl.java	Wed Mar 19 14:43:27 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TextInputControl.java	Wed Mar 19 15:46:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -637,10 +637,12 @@
         int last = wordIterator.following(Utils.clamp(0, getCaretPosition(), textLength-1));
         int current = wordIterator.next();
 
-        // skip the non-word region, then move/select to the beginning of the word.
+        // Skip non-word characters to the beginning of next word, but
+        // stop at newline. Then move the caret or select a range.
         while (current != BreakIterator.DONE) {
             for (int p=last; p<=current; p++) {
-                if (Character.isLetterOrDigit(text.charAt(Utils.clamp(0, p, textLength-1)))) {
+                char ch = text.charAt(Utils.clamp(0, p, textLength-1));
+                if (Character.isLetterOrDigit(ch) || ch == '\n') {
                     if (select) {
                         selectRange(getAnchor(), p);
                     } else {