I wrote some code to perform 2 node inserts. I added before/after undo
commands and undo/redo of the individual operations seemed to work fine.
But when I enclose the two operations in before/after changeGroup, then
redo doesn't work.

Does anyone know what I'm doing wrong?

To duplicate the issue:

   1. copy below xml to clipboard
   2. in a new leo outline ctrl-shift-c to paste as nodes
   3. highlight the "grouped insert redo test" node
   4. ctrl-b to execute it...two new headlines appear as expected
   5. ctrl-z to undo it...the two headlines disappear as expected
   6. ctrl-shift-z to redo it. The redo doesn't happen and the console
   shows this message:

redoGroup oops: expecting bunch.items.  bunch.kind = insert
redoGroup g.Bunch()
    dirtyVnodeList: []
    kind: insert
    newBack: <pos 139670364254672 childIndex: 0 lvl: 0 key:
139670742747232:0 NewHeadline>
    newChanged: True
    newDirty: True
    newMarked: False
    newP: <pos 139670364258088 childIndex: 1 lvl: 0 key: 139670364257360:1
test redo>
    newParent: <pos 139670364257808 [0] None>
    oldChanged: False
    oldDirty: False
    oldMarked: False
    oldSel: (0, 0)
    p: <pos 139670364286200 childIndex: 1 lvl: 0 key: 139670364257360:1
test redo>
    pasteAsClone: False
    redoHelper: <bound method Undoer.redoInsertNode of
<leo.core.leoUndo.Undoer object at 0x7f07a018dfd0>>
    undoHelper: <bound method Undoer.undoInsertNode of
<leo.core.leoUndo.Undoer object at 0x7f07a018dfd0>>
    undoType: Paste Node


Here is the xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
<leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1";
>
<leo_header file_format="2"/>
<vnodes>
<v t="bpt.20190818085349.1"><vh>test redo</vh>
<v t="bpt.20190818084547.1"><vh>grouped insert redo test</vh></v>
</v>
</vnodes>
<tnodes>
<t tx="bpt.20190818084547.1">@language python

undoType = 'insert first child twice'; u = c.undoer
parent = p.parent()
u.beforeChangeGroup(p, undoType)
undoData = u.beforeInsertNode(p)
child = parent.insertAsNthChild(0)
u.afterInsertNode(child, undoType, undoData)
undoData = u.beforeInsertNode(p)
child = parent.insertAsNthChild(0)
u.afterInsertNode(child, undoType, undoData)
u.afterChangeGroup(p, undoType)
c.redraw(child)
</t>
<t tx="bpt.20190818085349.1"></t>
</tnodes>
</leo_file>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAO5X8Cz%2BK%3DyzV3%2BQFErm%3D%3Dd5uc1ZfS580tyrjtiU_pnARDh9EA%40mail.gmail.com.

Reply via email to