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/CAO5X8Cwe4q%2B%2BVOoKcWVqPkKBYqF1oHCfEJ1mCnLOTJ-4nn5urg%40mail.gmail.com.
