PS: (another breadcrumb on the path, as it were)
The implication (I will follow up ;-) of this is that @bool
stayInTreeAfterSelect works 'differently' for goto-prev/next-node, and
goto-prev/next-visible, since these exhibit different "stay in tree focus"
behaviour for me, and both use treeSelectHelper(). That still seems odd...
J^n
On Friday, November 8, 2024 at 8:01:14 AM UTC jkn wrote:
> Hi Edward
> Thanks very much - you have beaten me to the steps I was going to take
> following Thomas' reply.
>
> I only have small time windows to investigate and experiment with Leo, my
> first post was to check whether others have the same experience.
>
> I came on this morning (UK time) to say "Thanks Thomas, I am guessing that
> there will a setting governing this behaviour, I will follow up".
>
> PS: your comment about only c.X methods affecting the gui makes sense, but
> I had not fully appreciated it, thanks
>
> Regards
> Jon N
>
>
> On Friday, November 8, 2024 at 7:31:15 AM UTC Edward K. Ream wrote:
>
>> On Thu, Nov 7, 2024 at 4:24 PM jkn <[email protected]> wrote:
>>
>> (I seem to be on a mild Leo roll at the moment...)
>>>
>>
>> So your next step as a power user is to read the code to answer your
>> question :-) You too, Thomas.
>>
>> Search for 'goto-next-visible' in leoPy.leo (your personal copy of
>> LeoPyRef.leo) or LeoPyRef.leo itself.
>>
>> Leo uses decorators to define each command. By convention, all command
>> names start with a single quote.
>>
>> You will find:
>>
>> @g.commander_command('goto-next-visible')
>> def selectVisNext(self: Cmdr, event: LeoKeyEvent = None) -> None:
>> """Select the visible node following the presently selected node."""
>> c, p = self, self.p
>> if not p:
>> return
>> if c.canSelectVisNext():
>> p.moveToVisNext(c)
>> c.treeSelectHelper(p)
>> else:
>> c.endEditing() # 2011/05/28: A special case.
>>
>> The special case only happens if the move *doesn't* happen, so let's
>> assume, as the name implies, that c.treeSelectHelper sets the focus.
>>
>> Note: any Leo dev should know that p.moveToVisNext has no effect on Leo's
>> gui. Only 'c' (Commander) methods do that.
>>
>> So your attention should immediately shift to *c.treeSelectHelper*.
>> Search for def treeSelectHelper:
>>
>> def treeSelectHelper(self, p: Position) -> None:
>> c = self
>> if not p:
>> p = c.p
>> if p:
>> # Do not call expandAllAncestors here.
>> c.selectPosition(p)
>> c.redraw_after_select(p)
>> c.treeFocusHelper() # This is essential.
>>
>> The last line executed is *c.treeFocusHelper*:
>>
>> def treeFocusHelper(self) -> None:
>> c = self
>> if c.stayInTreeAfterSelect:
>> c.treeWantsFocus()
>> else:
>> c.bodyWantsFocus()
>>
>> So the ivar *c.stayInTreeAfterSelect *determines the focus.
>>
>> Within Leo, c is an instance of the *Commands* class. Search for class
>> Commands. You'll see lots of ivars.
>>
>> Within the class node, search for *stayInTreeAfterSelect*. First you'll
>> find:
>>
>> self.stayInTreeAfterSelect = False
>>
>> Keep searching! In *c.initConfigSettings* you'll find:
>>
>> c.stayInTreeAfterSelect = getBool('stayInTreeAfterSelect')
>>
>> So there should be a setting,
>> *@bool stayInTreeAfterSelect*
>>
>> Use Leo's 'leo-settings' command (*Alt-X leo-set<tab>*) to open
>> LeoSettings.leo.
>>
>> Search for *@bool stayInTreeAfterSelect*
>>
>> You'll find the default is True. The body text contains:
>>
>> True: (Recommended) Selecting an outline node leaves the focus in the
>> outline pane.
>> If this is False it will be harder to use the arrow keys in the headline.
>> False: (Legacy) Selecting an outline node transfers focus to the body
>> pane.
>>
>> How hard was that?
>>
>> 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 visit
https://groups.google.com/d/msgid/leo-editor/8dd91f24-7831-4ad0-a9b8-f406dfc78e9bn%40googlegroups.com.