On Sun, 6 Dec 2009 11:41:44 +0200
"Ville M. Vainio" <[email protected]> wrote:
> BTW, this is why I advocate using nodes instead of positions when it
> makes sense. Positions are not durable.
True, my initial approach was embarrassingly naive and the CompSci gods
punished my by conspiring to making my tests appear to work.
But I think vnodes (or nodes, if that's what they're called now :-)
would benefit from a .doDelete() method similar to the one positions
have. I didn't want to call v._cutLinks(), partly because there's only
one call to it in the codebase (in p.doDelete()), and partly because it
obviously wasn't designed for deleting vnodes by the general public.
Unless I'm behind the times and you can do v.children.remove(v1) now,
but I don't think so.
I ended up doing this:
for v in cull:
p2 = c.vnode2position(v)
if c.positionExists(p2):
bunch = u.beforeDeleteNode(p2)
p2.doDelete()
u.afterDeleteNode(p2,undoType,bunch)
having collected the 'v's from the selected node iterator.
Seems to work, I'll push it and please let me know if there are any
more problems.
Cheers -Terry
--
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.