textual icon indicating copy to clipboard operation
textual copied to clipboard

Pick new keybinding for Tree's toggle_expand_all since no terminal seems to support shift+space

Open RedBeard0531 opened this issue 5 months ago • 4 comments

Have you checked closed issues? (https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed)

Have you checked against the most recent version of Textual? (https://pypi.org/search/?q=textual)

Feature requests

Please post feature requests to Ideas. (https://github.com/Textualize/textual/discussions/categories/ideas)

The bug

Currently the tree code binds shift+space to toggle_expand_all: https://github.com/Textualize/textual/blob/03979fc629579919d29c10a8ed6e10974fc05c4c/src/textual/widgets/_tree.py#L546-L548

However, I could not find a single terminal where textual keys shows a different output when I press space vs shift+space, so that action is unreachable. Once #5902 is resolved, ctrl+space may be a better option.

(I don't think textual diagnose will be helpful here, but if you need it I can include it)

RedBeard0531 avatar Jun 27 '25 09:06 RedBeard0531

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This project is developed and maintained by Will McGugan. Consider sponsoring Will's work on this project (and others).

This is an automated reply, generated by FAQtory

github-actions[bot] avatar Jun 27 '25 09:06 github-actions[bot]

I guess a workaround is to subclass the TreeView and redefine its bindings?

Anyway the set of TreeView bindings is very different from the ones used by Windows, which I'm more used to. Since it's probably hard to find a set of bindings that satisfy everyone, I guess subclassing may be necessary to achieve what you need.

fancidev avatar Jul 13 '25 23:07 fancidev

I think I would be inclined to agree with RedBeard0531 here - The default should ideally be something that works on all terminals if that's possible. I don't think there's anything else in Textual that uses a combination like this that isn't supported by all terminals.

edward-jazzhands avatar Jul 14 '25 06:07 edward-jazzhands

Please check #6074 as it enables detecting shift+space

adamritter avatar Aug 26 '25 11:08 adamritter