|
From: | thebohemian at gmx dot net |
Subject: | [Bug swing/26354] New: Removing single characters in JTextArea leaves model in broken state |
Date: | 18 Feb 2006 17:26:38 -0000 |
Consider that someone typed this into a JTextArea: abc def Now the caret is placed before the d and delete is pressed. This should remove the d and the caret should stay where it is. In Classpath the d is removed correctly but the cursor moves behind the c. The reason is that the code in PlainDocument.removeUpdate() joins the Element instances of the first and the second line. Inside the method is a call to rootElement.getElementIndex(). Given a value of 4 (offset of the d) this should return 1 but instead 0 is returned. For 5 the correct value of 1 is returned. The combination of the two indices lets the algorithm think that a line-spanning removal has taken place which in turn provokes that the elements are joined. What is odd is that the return values of getElementIndex() are OK when you call the before the removal is initiated. -- Summary: Removing single characters in JTextArea leaves model in broken state Product: classpath Version: 0.21 Status: UNCONFIRMED Severity: normal Priority: P3 Component: swing AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: thebohemian at gmx dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26354
[Prev in Thread] | Current Thread | [Next in Thread] |