[
https://issues.apache.org/jira/browse/PIVOT-1021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314215#comment-16314215
]
Roger Whitcomb commented on PIVOT-1021:
---------------------------------------
Just so I don't forget it over the weekend: here's what typically happens in
the "cut text at the end of a word":
(((((((((((((( start of cut ))))))))))))))))
Remove a segment of the Paragraph (node offset 0) at offset 13, count 4
Remove a segment of the TextSpan (node offset 8) at offset 13, count 4
Remove a segment of the TextNode (node offset 0) at offset 5, count 4
>>>>> TextPane.rangeRemoved: Document, offset 13, count 4
(((((((((((((( end of cut ))))))))))))))))
Note: the "TextPane.rangeRemoved" has no "removed text" along with it, so there
is no way to add a history item. We must find a way to provide the removed
text in this case. That is the issue.
> Undo after delete in TextPane can cause IllegalArgumentException
> ----------------------------------------------------------------
>
> Key: PIVOT-1021
> URL: https://issues.apache.org/jira/browse/PIVOT-1021
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Reporter: Roger Whitcomb
> Assignee: Roger Whitcomb
> Priority: Minor
>
> Under various conditions (such as selecting an entire word that is a
> TextSpan) deleting it with Ctrl/Cmd-X then Undo (Ctrl/Cmd-Z) causes an
> IllegalArgumentException:
> java.lang.IllegalArgumentException: Child node must be an instance of
> org.apache.pivot.wtk.text.Block
> STACK TRACE:
> at org.apache.pivot.wtk.text.Document.insert(Document.java:45)
> at org.apache.pivot.wtk.text.Element.add(Element.java:369)
> at org.apache.pivot.wtk.TextPane$RangeRemovedEdit.undo(TextPane.java:134)
> at org.apache.pivot.wtk.TextPane.undo(TextPane.java:796)
> at org.apache.pivot.wtk.skin.TextPaneSkin.keyPressed(TextPaneSkin.java:1360)
> at
> org.apache.pivot.wtk.Component$ComponentKeyListenerList.lambda$keyPressed$1(Component.java:477)
> at java.lang.Iterable.forEach(Unknown Source)
> at
> org.apache.pivot.wtk.Component$ComponentKeyListenerList.keyPressed(Component.java:477)
> at org.apache.pivot.wtk.Component.keyPressed(Component.java:2711)
> at
> org.apache.pivot.wtk.ApplicationContext$DisplayHost.processKeyEvent(ApplicationContext.java:1566)
> at java.awt.Component.processEvent(Unknown Source)
> at
> org.apache.pivot.wtk.ApplicationContext$DisplayHost.processEvent(ApplicationContext.java:945)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> ...
> Or sometimes an IndexOutOfBoundsException can occur instead (such as doing a
> second Undo right after the first).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)