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