Thomas Passin, thanks for your comment.

On Monday, May 4, 2020 at 6:23:08 AM UTC+2, Thomas Passin wrote:
>
>
> About clones, we always talk about cloning nodes, but it seems to me that 
> what actually gets cloned is an entire subtree - that is, the clone 
> includes (clones of) a node's descendants.  Perhaps a change in the 
> conceptual model of clones from nodes to subtrees would make it easier to 
> work out how to handle them.
>
> I'm not sure how a subtree is currently modeled in Leo.  Since a tree can 
> be built out of nodes that have child and parent nodes,  one can be 
> constructed without an explicit model for a (sub)tree.  But since many 
> operations we want to do are really on (sub)trees and not nodes, maybe an 
> explicit tree concept in addition to a node concept would be useful(if 
> there isn't one already).
>
>
VNode in Leo is always a subtree, although this subtree may be empty (it 
may contain no other nodes). In its current implementation it is not 
possible to separate node from the subtree. If a node contains at least one 
child, it is no longer possible to make a clone of just that node without 
its children. If you try to remove children from the clone, they will be 
removed from the outline too. You can copy just values from v node if you 
wish to have it isolated from its subtree for example when storing Leo 
document in '.db' format, all v-nodes are decomposed to their values (gnx, 
h, b, u, statusBits) and two lists one for parents and one for the 
children. Those two lists contain only gnxes not real v-nodes. Decomposed 
nodes are then stored in the db table. Later when we want to restore the 
outline from the db table we first create every node as an isolated single 
node not connected to any other node. And after all nodes are created, then 
we go through every list of gnxes and using them we link all children to 
their parents and vice versa. Of course this is not the only way to 
decompose v-nodes and recreate them from the decomposed data.

Vitalije

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/8b40d601-403b-4887-a789-7ecc1429de9b%40googlegroups.com.

Reply via email to