Hi, this patch contains my already approved fix for GapContent and another small change that fixes the remaining issue I was seeing.
While the GapContent fix makes it possible to remove the 'd' in this document
correctly:
abc
def
The change of the order of operations in AbstractDocument.remove makes it
possible to remove the 'c' from the same document.
What was wrong before the patch is that the content was already changed when
PlainDocument.removeUpdate is invoked. In the example above that method calls
getElementIndex() for offset 3 which was initially on the first line but since
the content is already modified it returns that offset 3 is on the second line.
This in turn leads the algorithm to the assumption that a line-spanning removal
has taken place and that the Elements representing these lines have to be
joined.
Both defects lead to the problems mentioned in PR 26354 which are now solved.
The patch was approved by Roman on IRC.
2006-02-20 Robert Schuster <[EMAIL PROTECTED]>
* javax/swing/text/GapContent.java:
(shiftGapEndUp): Corrected new mark value.
* javax/swing/text/AbstractDocument.java:
(remove): Changed order of operations.
cya
Robert
signature.asc
Description: OpenPGP digital signature
