classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] Fixing the selection handling in JTextComponent.


From: Meskauskas Audrius
Subject: [cp-patches] Fixing the selection handling in JTextComponent.
Date: Sat, 26 Feb 2005 19:58:41 +0100

The Mauve test have indicated wrong work of the JTextComponent.getSelectedText(). For example, if the text is 0123456789 and the selection covers the interval 2..5, the expected value is '234' and the returned value is '01234'.

Another test indicated that setSelectionStart(int) and setSelectionEnd(int) can set the 'dot' of the component carret ahead the 'mark' of this carret, something that should never happen unless moveCaretPosition(int) is called. This clearly shows that goes wrong in the first test.

Fixing this problem required to rewrite several selection-related methods in JTextComponent. The suggested path is attached. With this path, the selection handling seems operating as expected.

This case is covered by the two tests, gnu.testlet.javax.swing.JTextArea.text and additionally written gnu.testlet.javax.swing.JTextArea gettingText.

As this file uses tabulation symbol, the whitespace may not be correctly displayed in the patch. Please verify the attached java file before reporting the wrongly placed whitespace.

Audrius Meskauskas.

Attachment: JTextComponent.java
Description: Binary data

Attachment: JTextComponent.java.diff
Description: Binary data


reply via email to

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