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/CAMF8tS3tPk8c5yy1oGMVbpGbci_sEKt1%2BeKUWQ2hhYp00EYrPA%40mail.gmail.com.

Reply via email to