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 2017/06/13 00:28:01 UTC
svn commit: r1798555 -
/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
Author: rwhitcomb
Date: Tue Jun 13 00:28:01 2017
New Revision: 1798555
URL: http://svn.apache.org/viewvc?rev=1798555&view=rev
Log:
PIVOT-850: Fix a caret positioning problem in TextInput.
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=1798555&r1=1798554&r2=1798555&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 Tue Jun 13 00:28:01 2017
@@ -118,10 +118,11 @@ public class TerraTextInputSkin extends
}
}
- private Rectangle getCaretRectangle(TextHitInfo caret) {
+ private Rectangle getCaretRectangle(TextHitInfo textCaret) {
TextInput textInput = (TextInput)getComponent();
AttributedStringCharacterIterator composedText = textInput.getComposedText();
- return GraphicsUtilities.getCaretRectangle(caret, composedText, padding.left + 1, padding.top + 1);
+ Bounds selectionStartBounds = getCharacterBounds(textInput.getSelectionStart());
+ return GraphicsUtilities.getCaretRectangle(textCaret, composedText, selectionStartBounds.x, padding.top + 1);
}
/**
@@ -1652,18 +1653,12 @@ public class TerraTextInputSkin extends
int y = padding.top + 1;
- leadingSelectionBounds = new Bounds(x, y, 0, height
- - (padding.top + padding.bottom + 2));
+ leadingSelectionBounds = new Bounds(x, y,
+ 0, height - (padding.top + padding.bottom + 2));
}
if (composedTextCaret != null) {
caret = getCaretRectangle(composedTextCaret);
- Bounds selectionStartBounds = leadingSelectionBounds;
- if (selectionStart >= n) {
- selectionStartBounds = getCharacterBounds(selectionStart);
- }
- int offsetToComposedTextStart = selectionStartBounds.x - padding.left - 1;
- caret.translate(offsetToComposedTextStart, 0);
} else {
caret = leadingSelectionBounds.toRectangle();
}