You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/10/26 17:29:12 UTC
svn commit: r829851 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Author: gbrown
Date: Mon Oct 26 16:29:12 2009
New Revision: 829851
URL: http://svn.apache.org/viewvc?rev=829851&view=rev
Log:
Minor updates to TextAreaSkin.
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=829851&r1=829850&r2=829851&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Mon Oct 26 16:29:12 2009
@@ -753,6 +753,7 @@
int n = rows.getLength();
if (n == 0
&& from == -1) {
+ // There are no rows; select the terminator character
offset = 0;
} else {
int i;
@@ -1511,7 +1512,7 @@
textArea.setSelection(offset, 0);
Bounds characterBounds = getCharacterBounds(offset);
- component.scrollAreaToVisible(0, characterBounds.y, getWidth(),
+ component.scrollAreaToVisible(0, characterBounds.y, characterBounds.width,
characterBounds.height);
consumed = true;
@@ -1525,7 +1526,7 @@
textArea.setSelection(offset, 0);
Bounds characterBounds = getCharacterBounds(offset);
- component.scrollAreaToVisible(0, characterBounds.y, getWidth(),
+ component.scrollAreaToVisible(0, characterBounds.y, characterBounds.width,
characterBounds.height);
consumed = true;
@@ -1605,8 +1606,7 @@
@Override
public void selectionChanged(TextArea textArea, int previousSelectionStart,
int previousSelectionLength) {
- if (documentView != null
- && documentView.isValid()) {
+ if (documentView != null) {
if (textArea.getSelectionLength() == 0) {
// Repaint the previous caret bounds
textArea.repaint(caret.x, caret.y, caret.width, caret.height);
@@ -1646,10 +1646,14 @@
int selectionStart = textArea.getSelectionStart();
Bounds startCharacterBounds = getCharacterBounds(selectionStart);
- caret.x = startCharacterBounds.x;
- caret.y = startCharacterBounds.y;
- caret.width = 1;
- caret.height = startCharacterBounds.height;
+ if (startCharacterBounds != null) {
+ caret.x = startCharacterBounds.x;
+ caret.y = startCharacterBounds.y;
+ caret.width = 1;
+ caret.height = startCharacterBounds.height;
+ } else {
+ System.err.println("Selection bounds are null.");
+ }
}
private void showCaret(boolean show) {