[revised patch]
reset selection pointer and range for null or empty text
(cheers)
Index: TextArea.java
===================================================================
--- TextArea.java (revision 756135)
+++ TextArea.java (working copy)
@@ -228,7 +228,7 @@
public void setText(String text) {
Document document = null;
- if (text != null) {
+ if (text != null && 0 < text.length()) {
try {
PlainTextSerializer serializer = new PlainTextSerializer();
StringReader reader = new StringReader(text);
@@ -236,6 +236,12 @@
} catch(SerializationException exception) {
} catch(IOException exception) {
}
+ } else {
+ selectionStart = 0;
+ selectionLength = 0;
+
+ document = new Document();
+ document.add(new Paragraph());
}
setDocument(document);