Thanks a lot. I'll give it a try tonight and also see if I can get similar code working for clone and move. After that I can try to put it all together.
On Sun, Aug 18, 2019, 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/CAO5X8Cx_6CbA-k9gNenfD0AiJspE2UAA9vPTEpP-ywK9QS3PUA%40mail.gmail.com.
