On Sat, Apr 26, 2008 at 12:13 PM, Edward K. Ream <[EMAIL PROTECTED]>
wrote:
I would not recommend using the sax-graph branch just yet...
A brief period of testing revealed two, possibly three bugs that must be
fixed before the sax-graph branch will be usable. One bug in particular is
interesting. Code similar to the following code appears in several places
in leoNodes.py:
def insertAsNthChild(self,parent):
p = self
p._unlink()
p._linkAsNthChild(parent)
This works in the "linked" world, but it must be modified for the graph
world. Indeed, unlinking p can change the position at which p is to be
linked. For example, suppose we have:
A
B
C
And we wish to move B to the first child of C. After unlinking B, we will
have:
A
C
Notice: C's childIndex has changed from 2 to 1 but it has *not* changed in
the parent arg to p._linkAsNthChild(parent). To handle this, Leo will need
code such as:
def insertAsNthChild(self,parent):
p = self
p._unlink()
parent = p._adjustPositionAfterUnlink(parent)
p._linkAsNthChild(parent)
p._adjustPositionAfterUnlink(parent) can adjust the parent position as
needed **provided** that p._unlink() does *not* change position p, but only
changes p.v.t.children, p.v.t.parents and p.v.t.vnodeList. In particular,
p._adjustPositionAfterUnlink(parent) only needs to compare the stacks of
positions p and parent in order to adjust parent. This breaks the circular
dependency: the position can be adjusted even after the actual links
(parents, children arrays) have be changed.
I worked this out in the warm-water pool while doing p.t. for my arthritic
shoulder :-) It should work out as I expect, but there could be other
complications...
Edward
P.S. As a result of this oversight, moves can act very strangely at present
:-) Also, undo move can crash. A possibly unrelated bug is that ancestor
@file nodes are not marked dirty when a clone of a descendant of the @file
nodes are changed. I hope to fix all these bugs tomorrow.
EKR
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---