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/04/16 18:23:30 UTC

svn commit: r1829309 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java

Author: rwhitcomb
Date: Mon Apr 16 18:23:30 2018
New Revision: 1829309

URL: http://svn.apache.org/viewvc?rev=1829309&view=rev
Log:
PIVOT-891:  Fix the word selection logic in TextPane with mouse
double click.  Just needed to subtract and re-add the row starting
offset around CharUtils.selectWord.

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java?rev=1829309&r1=1829308&r2=1829309&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java Mon Apr 16 18:23:30 2018
@@ -938,13 +938,14 @@ org.apache.pivot.util.Console.logMethod(
         if (button == Mouse.Button.LEFT) {
             int index = getInsertionPoint(x, y);
             if (index != -1) {
+                int rowStart = getRowOffset(document, index);
                 if (count == 2) {
-                    CharSpan charSpan = CharUtils.selectWord(getRowCharacters(document, index), index);
+                    CharSpan charSpan = CharUtils.selectWord(getRowCharacters(document, index), index - rowStart);
                     if (charSpan != null) {
-                        textPane.setSelection(charSpan);
+                        textPane.setSelection(charSpan.offset(rowStart));
                     }
                 } else if (count == 3) {
-                    textPane.setSelection(getRowOffset(document, index), getRowLength(document, index));
+                    textPane.setSelection(rowStart, getRowLength(document, index));
                 }
             }
         }