On Fri, Dec 2, 2011 at 6:26 AM, Edward K. Ream <[email protected]> wrote:
[...]
>> p = p.moveToFirstChildOf(n)
>
> The proper idiom is:
>
> p.moveToFirstChildOf(n)
>
> Does this work for you? If it does, I probably should remove the
> "return p" from the end of the position move methods.
I didn't originally have the "p =". That just happened to be the last
thing I tried before sending the email. So this code gives the same
results:
n = p.insertAfter()
n.h = "test"
g.es('1: exists n: %s, p: %s' % (c.positionExists(n), c.positionExists(p)))
p.moveToFirstChildOf(n)
g.es('2: exists n: %s, p: %s' % (c.positionExists(n), c.positionExists(p)))
c.redraw(p)
BTW, the output to the log pane is:
1: exists n: True, p: True
2: exists n: False, p: False
Here is the relevant code that is getting executed in c.setCurrentPosition():
7822 -> if p and not c.positionExists(p): # 2011/02/25:
7823 c._currentPosition = c.rootPosition()
7824 if trace: trace('Invalid position: %s, root: %s' % (
7825 repr(p and p.h),
7826 repr(c._currentPosition and c._currentPosition.h)),
7827 g.callers())
7828
7829 # Don't kill unit tests for this kind of problem.
7830 return
This seems dangerous as the end result is that the rootPosition is
selected in the outline pane, but the original p position is still
selected in the body. I didn't notice this and started typing into
the body which ended up clobbering the real body text originally in
rootPosition.
Brian
--
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.