I've been thinking about this a lot and I've come to the conclusion that
there should be a separate command that will display all the clone
positions of a given node. Maybe the original could be renamed from
'show-clones' to 'show-clone-parents' and this one could be called
'show-clone-ancestors'
g.es(f"Ancestors of '{p.h}':")
for clone in c.all_positions():
if clone.v == p.v:
unl = clone.get_UNL(with_file=False, with_index=False)
runl = " <- ".join(unl.split("-->")[::-1][1:]) # reverse and drop
first
g.es(" ", newline = False)
g.es_clickable_link(c, clone, 1, runl + "\n")
SegundoBob, this one should work better for your clone structure, though in
general there will be more output from this one than the other one.
On Tue, Oct 8, 2019 at 8:56 AM Brian Theado <[email protected]> wrote:
> In my previous email I was pointing the finger at g.handleUnl doing
> something wrong for SegundoBob's use case. However, I played with that a
> little bit and it seems to handle links to clones with the same parent just
> fine. Now I'm suspecting c.vnode2allPositions is not appropriate for the
> use case.
>
> Try pasting these nodes and use ctrl-b on either of the 'child' clones.
> Then change which line is commented out and use ctrl-b again. In both cases
> the same position is selected. IOW, it looks to me like even though
> c.vnode2allPositions is returning two positions, they both point to the
> same position in the outline. The purpose of vnode2allPositions must be
> different than I expect.
>
> <?xml version="1.0" encoding="utf-8"?>
> <!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
> <leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1"
> >
> <leo_header file_format="2"/>
> <vnodes>
> <v t="btheado.20191008074512.1"><vh>test</vh>
> <v t="btheado.20191008074524.1"><vh>child</vh></v>
> <v t="btheado.20191008074524.1"></v>
> </v>
> </vnodes>
> <tnodes>
> <t tx="btheado.20191008074512.1">@language python</t>
> <t tx="btheado.20191008074524.1"># Try ctrl-b with each of these lines and
> it will select the same position
> c.selectPosition(c.vnode2allPositions(p.v)[0])
> #c.selectPosition(c.vnode2allPositions(p.v)[1])
> </t>
> </tnodes>
> </leo_file>
>
> On Tue, Oct 8, 2019 at 3:59 AM Edward K. Ream <[email protected]> wrote:
>
>> On Mon, Oct 7, 2019 at 5:49 PM Segundo Bob <[email protected]> wrote:
>>
>> Brian is right. Edward, I think your fix does not fix the problem.
>>>
>>
>> Please let me know what code you want, and i'll put it in. Better yet,
>> you could do it yourself.
>>
>> 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/CAMF8tS0DCt4GyhBQ4EG-Ujoj3EuXDuHuorWHYDwsztQnTHRcSw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/leo-editor/CAMF8tS0DCt4GyhBQ4EG-Ujoj3EuXDuHuorWHYDwsztQnTHRcSw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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/CAO5X8CwLv%2BAHeKEHQe47Tga5P23dbYb4y87-32%2BZyq1Pf-k_bQ%40mail.gmail.com.