I found a core function which uses undo groups and used this code to call it:
c.createNodeHierarchy(['a', 'b', 'c'], parent=p) c.redraw(p) Redoing this operation gives the same error as the test code and the bead+1 fixes it also. I think this bug is affecting all grouped redo. On Mon, Aug 19, 2019 at 7:54 PM Brian Theado <[email protected]> wrote: > I think the issue is in u.redoGroup (leo/core/LeoPyRef.leo#Code-->Core > classes-->@file leoUndo.py-->class Undoer-->u.redo helpers-->u.redoGroup) > > The line: > bunch = u.beads[*u.bead*]; count = 0 > > Should be: > bunch = u.beads[*u.bead+1*]; count = 0 > > That line is in both u.undoGroup and u.redoGroup. For undoGroup u.bead is > valid, but for redo it should be operating with u.bead+1. > > Brian > > > On Sun, Aug 18, 2019 at 5:18 PM Brian Theado <[email protected]> > wrote: > >> Hmm, it didn't work for me. Using your code and following the same steps >> as my original email, I get the same error message. >> >> After that if I start from step #4 (the ctrl-b step) again, then the undo >> and the redo work. But then if I start again at step #4, I get the original >> error message again. >> >> Could you confirm it is working for you even starting from scratch? >> >> On Sun, Aug 18, 2019 at 9:32 AM Edward K. Ream <[email protected]> >> wrote: >> >>> >>> >>> On Sun, Aug 18, 2019 at 8:28 AM Edward K. Ream <[email protected]> >>> wrote: >>> >>>> >>>> On Sun, Aug 18, 2019 at 8:24 AM Edward K. Ream <[email protected]> >>>> wrote: >>>> >>>> At least one problem is that p changes after: >>>> >>>> child = parent.insertAsNthChild(0) >>>> >>> >>> This works: >>> >>> groupType = 'insert child twice' >>> undoType = 'insert first child twice'; u = c.undoer >>> # Start group. >>> parent = p.parent() >>> u.beforeChangeGroup(parent, groupType) >>> # 1 >>> undoData = u.beforeInsertNode(parent) >>> child = parent.insertAsNthChild(0) >>> u.afterInsertNode(child, undoType, undoData) >>> # 2 >>> undoData = u.beforeInsertNode(parent) >>> child = parent.insertAsNthChild(0) >>> u.afterInsertNode(child, undoType, undoData) >>> # End group. >>> u.afterChangeGroup(parent, groupType) >>> c.redraw(child) >>> >>> This fails if p.parent() does not exist, but that's another matter. >>> >>> Also note the two different undo types. That's probably not necessary, >>> but it's better style. >>> >>> Edward >>> >>> -- >>> 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/CAMF8tS1RaaS8qumebOtNLaT%3DLVpx_kajWcTjjQUGfnV8LuW3Ng%40mail.gmail.com >>> <https://groups.google.com/d/msgid/leo-editor/CAMF8tS1RaaS8qumebOtNLaT%3DLVpx_kajWcTjjQUGfnV8LuW3Ng%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- 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/CAO5X8CzMuHdJKKhmH1aZ19AGAx3GoVXpNEty_UBcjs5k2A1BPw%40mail.gmail.com.
