On Wed, Oct 5, 2011 at 3:13 PM, Edward K. Ream <[email protected]> wrote:

>    next = p.copy() if after and after == p.next() else after
>
> Yes, this is a hack, but it's a really great hack :-)

Well, it's not great yet.  My first attempt at the undo failed with
this message::

    badUnlink **can not happen: children[0] != p.v

We can fix this and clean up the code (make the hack official) this way:

    next = p.nodeAfterTreeAfterDelete()

I just realized that nodeAfterTree should be called positionAfterTree,
but I digress :-)

The point is that the new method can create the proper position, with
the proper p.v, in a "relaxed" manner--it doesn't have to be a
one-liner.  The name clarifies the code's intention.  Much better
style.

I really like the new vnode-oriented approach.  It may take a bit of
work to get right, but it should be worth it.

Ironically, the command simply appends a copy of each deleted
*position* to an undo list.  That is, copying the position is the easy
way to get all the (vnode-oriented) undo information:  parent_v is in
p.stack[-1],  the vnode is p.v, and the childIndex is p._childIndex.

In short, all is going well :-)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to