classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: Caret update fix


From: Roman Kennke
Subject: [cp-patches] FYI: Caret update fix
Date: Fri, 30 Sep 2005 21:56:24 +0200 (CEST)
User-agent: SquirrelMail/1.4.4

Hi,

Tony pointed out a bug in text components. The caret was not updated
correctly when inserting text. The cause was that the caret position was
updated at several places simultanously, which is of course wrong. I fixed
that by adding a DocumentListener to the DefaultCaret, so that the caret
can take caret of itself and the caret position has not to be handled in
any other place.

2005-09-30  Roman Kennke  <address@hidden>

        * javax/swing/JTextPane.java
        (replaceSelection): Don't update the caret position here.
        * javax/swing/plaf/basic/BasicTextUI.java
        (DocumentHandler.insertUpdate): Likewise.
        (DocumentHandler.removeUpdate): Likewise.
        * javax/swing/text/DefaultCaret.java
        (DocumentHandler): New inner class. Handles caret position updates.
        (PropertyChangeHandler): New inner class. (Un)installs document
        listener when the text component's document changes.
        (install): Install the new listeners on the text component.
        (deinstall): Deinstall the new listeners on the text component.
        * javax/swing/text/DefaultEditorKit.java
        (DefaultKeyTypedAction.actionPerformed): Don't update the caret
        position here.


/Roman

Attachment: caretfixes.diff
Description: Text Data


reply via email to

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