[ 
https://issues.apache.org/jira/browse/PIVOT-1021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16320560#comment-16320560
 ] 

Roger Whitcomb commented on PIVOT-1021:
---------------------------------------

Additional notes on the partial node cut:
This is a whole node cut (notice the "rangeRemoved" is from a Paragraph, and 
the "nodesRemoved" will do the undo history):
(((((((((((((((((((( start of cut )))))))))))))))))))))
Remove a segment of the Paragraph (node offset 0) at offset 5, count 2
TextPane org.apache.pivot.wtk.TextPane$2.rangeRemoved(TextPane.java:309): 
node=Paragraph, offset=5, count=2
TextPane org.apache.pivot.wtk.TextPane$2.nodesRemoved(TextPane.java:275): 
node=Paragraph, offset=5
((((((((((((((((((((  end of cut  )))))))))))))))))))))

This is a partial node cut (the "rangeRemoved" is from a TextNode):
(((((((((((((((((((( start of cut )))))))))))))))))))))
Remove a segment of the Paragraph (node offset 0) at offset 10, count 3
Remove a segment of the TextSpan (node offset 8) at offset 10, count 3
Remove a segment of the TextNode (node offset 0) at offset 2, count 3
TextPane org.apache.pivot.wtk.TextPane$2.rangeRemoved(TextPane.java:309): 
node=TextNode, offset=10, count=3
((((((((((((((((((((  end of cut  )))))))))))))))))))))

> 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)

Reply via email to