On Sat, Aug 17, 2019 at 2:14 PM Brian Theado <[email protected]> wrote:

A position consists of *a stack of ancestor vnodes*, and *a child index*.
>>
>
> Excellent, this is a huge help. I had it in my head before that there was
> some kind of linked list and C-style pointer type of thing going on.
>

Glad this helped.  It's always good to consult the sources. Having said
that, the author of code has the highest level understanding of what's
going on, so it's also good to ask.

What I didn't realize is that just because those are the only operations in
> which *all* saved positions are safe, doesn't mean there aren't *some*
> saved positions which will still be safe after other operations.
>

Yes, that could be helpful.  You can design your intermediate steps so that
they preserve the positions you care about.

> Armed with the knowledge of what a position is, I came up with these
> examples:
>
>    1. Position p gains a new following sibling (i.e. p2 =
>    p.insertAfter()). In this case both p2 and p are safe. With the more
>    restrictive rules, I thought only p2 would be safe, but p is still ok
>    because its *child index* can only go wrong if previous siblings are
>    inserted or modified
>    2. Position p gains a new niece/nephew from either previous or
>    following siblings. Again in this case the position p remains valid
>    3. When changing a following sibling of position p to be a
>    niece/nephew of any sibling, the position p remains valid
>
> Yes, I think that's right.


> So armed with this knowledge and the code Vitalije share, I was able to
> re-write my code to be much simpler.
>

Glad to hear it.

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/CAMF8tS3dt8%2B6DkOy9w2cnFezPhkwGK%3DOKqQbEUf1_6BKOotfXA%40mail.gmail.com.

Reply via email to