summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2018-03-05 22:29:13 -1200
committerIlia Motornyi <elmot@vaadin.com>2018-03-06 13:29:13 +0300
commit46e0c06fe758b109f62edda7d4665fc21417759c (patch)
treea363a7dc11785c145b163bb988c14f28f1f9218e /client
parentbc515ea11d08850a59162a22874e929eb4562d37 (diff)
downloadvaadin-framework-46e0c06fe758b109f62edda7d4665fc21417759c.tar.gz
vaadin-framework-46e0c06fe758b109f62edda7d4665fc21417759c.zip
Enable setting cursor after the last character (#10670)
* Enable setting cursor after the last character Resolves #9157 * Reformat the code * Reformat the code using conventions
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java
index d5a1295f95..4d73996b7f 100644
--- a/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java
@@ -40,7 +40,8 @@ public abstract class AbstractTextFieldConnector extends AbstractFieldConnector
@Override
public void selectRange(int start, int length) {
int textLength = getAbstractTextField().getValue().length();
- start = restrictTo(start, 0, textLength - 1);
+ //Enable setting cursor position after the last character
+ start = restrictTo(start, 0, length == 0 ? textLength : (textLength - 1));
length = restrictTo(length, 0, textLength - start);
getAbstractTextField().setSelectionRange(start, length);
}