classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: Patch for swing.text classes partially fixes bug 24192


From: Anthony Balkissoon
Subject: [cp-patches] FYI: Patch for swing.text classes partially fixes bug 24192
Date: Tue, 04 Oct 2005 15:42:12 -0400

This is a partial (about half) fix for bug 24192.  Actually this fixes
all of bug 24192, but all the implementations in "insert" functions
still need to be mirrored in the "remove" functions.  That will be done
tomorrow.

The testcase for that bug report now works much better, you can find it
at:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24192

Once this is fully and properly implemented, View classes can override
insertUpdate and they'll be notified when text is inserted into
Documents and can make necessary adjustments.  This will allow better
caching for things like preferred sizes because they can be calculated
on the fly as text is inserted or removed.  This will, for instance,
improve the terrible performance reported in bug 24152.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24152


2005-10-04  Anthony Balkissoon  <address@hidden>

        * 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.

--Tony

Attachment: AbstractDocumentInsertStringElementChange.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]