On Wednesday, May 27, 2020 at 1:01:53 PM UTC+10, Edward K. Ream wrote: > > On Saturday, May 23, 2020 at 2:36:21 AM UTC-5, John Clark wrote: > > I have started work on #1593 > <https://github.com/leo-editor/leo-editor/issues/1593>. It is tricky. > Some initial experiments failed spectacularly. > > Instead of using a copy-node followed by the new paste-as-template > command, it *might *be better to create a new copy-as-template followed > by the existing paste-retaining-clones commands. So let's use the term > "copy and paste" to denote whatever commands turn out to be best. > > >> Let's say we have a tree like below. Note that all nodes are NOT clones >> unless specifically stated: >> >> Node A >> + Node A1 >> + Node A2 >> + Node A3 >> Node B >> + Node A1 (a clone) >> + Node B2 >> + Node A3 (a clone) >> > > There is a problem in your example. A1 and A2 can't be clones in node B > unless A1 and A3 are clones in Node A (or somewhere else). Did you mean > that A1 and A2 in A should also be clones? It makes a difference. > > This question is: "what nodes should be clones after the copy and paste?" > There are at least two possible answers: > > 1. [non-local] *All* nodes in B that were clones when B was copied, > provided that they could again be clones after being pasted. > > 2. [local] Only nodes in B that were clones of *other* nodes in B when > the copy was made. > > I infer answer 1 if A1 and A3 in A should have been labeled "a clone". > Otherwise, I infer answer 2. > > Either way can be made to work, but I would like your answer before going > further. I am particularly interested in some examples of how this kind of > templating would be useful for you. > > Edward >
I'm going to assume you made a typo in your reference to A2, because A2 is not involved in the proposed clone-preserving copy-and-paste. Nevertheless, I think a further expansion on my original example is in order, this time including nodes that are cloned internally to the source tree to facilitate discussion of that case. I'll use different naming to avoid confusion. Suppose I start with this: Node X + Node X1 + Node X2 + Node X3 I then build a new tree, called Node Y, with some children that are unique and some that are clones of the children of Node X, resulting in the tree as shown below. Note I've put comments in to clearly identify the clones. We could call Node Y our "template": Node X + Node X1 + Node X2 + Node X3 Node Y + Node Y1 # an "internal" clone of Y1 below + Node Y2 + Node Y1 # an "internal" clone of Y1 above + Node Y3 + Node X3 # an "external" clone of X3 which is under Node X Now I've built my "template", rooted at Node Y, I want to put it to use by making a "copy preserving clones" of it. Now, as you rightly note, here arises the question of what to do about clones that are purely local to the source node. I've thought about it in the sense of the templating use case, and this is what I believe the behaviour should be: Node X + Node X1 + Node X2 + Node X3 Node Y + Node Y1 # an "internal" clone of Y1 below + Node Y2 + Node Y1 # an "internal" clone of Y1 above + Node Y3 + Node X3 # an "external" clone of X3 which is under Node X Node Y + Node Y1 # a copy, but an internal clone of Node Y1 (below) + Node Y2 # a copy + Node Y1 # a copy, but an internal clone of Node Y1 (above) + Node Y3 # a copy + Node X3 # an "external" clone of X3 which is under Node X For brevity, I denote clones that are internal to the source tree only as "local clones". In the templating use case, I think there's a strong case to be made for NOT linking local clones under the source node in the the copied tree. Doing so allows provisioning of clones internally in the source "template" that define content that is shared around the children of the template, but is likely to be different in deployments (copies) of that template. I hope that makes sense. John -- 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/02b727ef-b1aa-413a-b357-5b4622533e03%40googlegroups.com.
