Work on #1631 <https://github.com/leo-editor/leo-editor/issues/1631> has
taken an unexpected turn. The issue has been renamed "Eliminate
v.expandedPositions". Instead of using this list (and trying to update it),
c.shouldBeExpanded(p) uses *no *data that must be kept in sync with the
outline.
The new scheme isn't perfect, as you can see for itself. The difficult case
involves a nodes having two clones (of the same node) as direct children.
Like this (As usual, ` denotes cloned nodes):
- A
- B`
- C
-D
- B`
- C
Try expanding A and B` in various orders. If you collapse A and then expand
A, *both* B` nodes will be expanded, even if only one was expanded
previously. This is slightly annoying. Happily, this situation is rare.
*Aha: a vnode-oriented approach would not help!*
As a thought experiment, I considered *vnode-oriented positions*. The
*VPosition* class would be similar to the Position class, except it would
not use an _childIndex ivars. You can think of the VPosition class a
projection of the Position class into a pure vnode space. In less
highfalutin terms, a VPosition would simply consist of a stack of vnodes.
Hah! When the outline changes, it's no easier to keep VPositions in sync
than it would be to keep Positions in sync! When a node moves, it's stack
would changes pretty much exactly as does the stack in Positions.
*Summary*
The new scheme is in the bug-1631 branch
<https://github.com/leo-editor/leo-editor/tree/bug-1631>.
c.shouldBeExpanded uses a purely algorithmic approach. c.shouldBeExpanded
does not use any data that needs to change when the outline changes.
A thought experiment shows that remembering expanded *vnodes *will suffer
the same problems as remembering expanding *positions*.
Imo, the new scheme is probably the best that can be done. There is no need
to change the undo/redo code, or any of the code that moves, inserts or
deletes nodes. There is no need to have the gui code do extra work.
Your comments, please, amigos.
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/7c33b17d-29bf-443d-b2b1-a662b8955c9bo%40googlegroups.com.