diff options
author | Anthony Balkissoon <abalkiss@redhat.com> | 2005-10-04 19:37:18 +0000 |
---|---|---|
committer | Anthony Balkissoon <abalkiss@redhat.com> | 2005-10-04 19:37:18 +0000 |
commit | 04b1298eb656757a893050f34898310d8f155d43 (patch) | |
tree | 81097cef455f501829ec0e7b3dbf01e92962e42a /javax/swing/text/PlainView.java | |
parent | 6a827546cc6fe57f0c38723834a130eb538e9346 (diff) | |
download | classpath-04b1298eb656757a893050f34898310d8f155d43.tar.gz |
2005-10-04 Anthony Balkissoon <abalkiss@redhat.com>
* javax/swing/text/AbstractDocument.java:
(insertString): If inserting a string into the Content returns an
UndoableEdit, then add an ElementEdit to the DocumentEvent before
firing.
(remove): Don't fire a removeUpdate unless some content was actually
removed.
* javax/swing/text/GapContent.java:
(UndoInsertString): New class to implement UndoableEdit functions.
(insertString): Return an UndoableEdit instead of null. Also use
locally calculated length of String rather than calculating again.
* javax/swing/text/JTextComponent.java:
(setText): If the Document is an AbstractDocument this should pass
through AbstractDocument.replace rather than calling remove and insert.
* javax/swing/text/PlainView.java:
(determineMaxLength): Keep track of which line was the longest as well
as the length of it. We'll need this to know when the longest line is
removed and we need to redetermine the longest line.
Diffstat (limited to 'javax/swing/text/PlainView.java')
-rw-r--r-- | javax/swing/text/PlainView.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/javax/swing/text/PlainView.java b/javax/swing/text/PlainView.java index 75450b03a..5ae1dfa61 100644 --- a/javax/swing/text/PlainView.java +++ b/javax/swing/text/PlainView.java @@ -62,6 +62,9 @@ public class PlainView extends View /** The length of the longest line in the Document **/ float maxLineLength = -1; + /** The longest line in the Document **/ + Element longestLine = null; + protected FontMetrics metrics; public PlainView(Element elem) @@ -237,7 +240,11 @@ public class PlainView extends View { } int width = metrics.charsWidth(seg.array, seg.offset, seg.count); - span = Math.max(span, width); + if (width > span) + { + longestLine = child; + span = width; + } } maxLineLength = span; return maxLineLength; |