A couple of small points re. node expand/contract

41 views
Skip to first unread message

jkn

unread,
Jun 20, 2022, 8:14:39 AM6/20/22
to leo-editor
A couple of minor observations/questions.

1) Alt+] is mapped to 'expand node' by default. Any reason why Alt+[ is not mapped to 'contract-node' by default?

2) I would find it useful to have a 'toggle expand node' shortcut, so the same keystroke will toggle the expand state of the current node. I have a feelingthat I wrote such a command a long time ago. I will try to hunt it down, or re-create ... but would this be a good candidate to be a built-in 'primitive' within Leo?

Thanks, Jon N

tbp1...@gmail.com

unread,
Jun 21, 2022, 6:03:20 PM6/21/22
to leo-editor
Looks to me like an simple oversight.  In leoSettings.leo (where the base key bindings are defined), Alt-[ is mapped to contract-node but only in emacs mode.  Alt-] is mapped to expand-node in both regular and emacs modes.  I didn't find any other mapping for Alt-[ that would conflict.

I'd just go ahead and put it into your myLeoSettings.leo file if you haven't already done so.

jkn

unread,
Jun 22, 2022, 3:38:20 AM6/22/22
to leo-editor
Yes, I've already put the setting into myLeoSettings.leo - it was a suggestion about consistency of the 'stock' settings.

FWIW here's the simple command I previously wrote to toggle the expand state. I had to make a small change, c.redraw() no longer accepts a 'setFocus' keyword?

def toggleExpandState ():

""" Toggle the expand state of the current node

"""

trace = False and not g.unitTesting

# c = self; p = c.p

# set up the functions to call

if p.isExpanded():

fa = p.contract

frd = c.redraw_after_contract

else:

fa = p.expand

frd = c.redraw_after_expand

# perform the calls

fa()

if p.isCloned():

# if trace: g.trace('***redraw')

c.redraw()

else:

# frd(p,setFocus=True)

frd(p)

toggleExpandState()

Edward K. Ream

unread,
Jun 26, 2022, 1:47:54 PM6/26/22
to leo-editor
On Mon, Jun 20, 2022 at 7:14 AM jkn <jkn...@nicorp.f9.co.uk> wrote:
A couple of minor observations/questions.

1) Alt+] is mapped to 'expand node' by default. Any reason why Alt+[ is not mapped to 'contract-node' by default?

Fixed at d3ea1fc in devel.

Edward

jkn

unread,
Jun 26, 2022, 5:53:29 PM6/26/22
to leo-editor
Thanks; I know it is a small point...
Reply all
Reply to author
Forward
0 new messages