Add shift+arrows for collapse/expand all

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 20:30:14 +02:00
co-authored by Claude Sonnet 5.5
parent e4340fb35e
commit 90ea9cc241
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ do **not** mark the parent itself as `changed`.
**Decision.** Only the first level is visible. `→` expands and enters the **Decision.** Only the first level is visible. `→` expands and enters the
first child, `←` collapses and goes to the parent, `space` toggles, first child, `←` collapses and goes to the parent, `space` toggles,
`L`/`H` (or `ctrl+→/←`) expand/collapse all (see [ux-guide.md](ux-guide.md#navigation)). `shift+→/←`, `L`/`H` (or `ctrl+→/←`) expand/collapse all (see [ux-guide.md](ux-guide.md#navigation)).
`←` on an expanded node collapses it in place, so a node can be closed `←` on an expanded node collapses it in place, so a node can be closed
without leaving it. Remembered expansion is kept on collapse, but reset by without leaving it. Remembered expansion is kept on collapse, but reset by
"collapse all". "collapse all".
+5 -5
View File
@@ -26,7 +26,7 @@
my_submodule_3 unpushed origin/main ↑1 │ Pinned b7c8d9e Hotfix null pointer my_submodule_3 unpushed origin/main ↑1 │ Pinned b7c8d9e Hotfix null pointer
libs/ │ Checkout b7c8d9e Hotfix null pointer libs/ │ Checkout b7c8d9e Hotfix null pointer
logging origin/main ↓3 │ Tip 6f5e4d3 Release 2.1.0 logging origin/main ↓3 │ Tip 6f5e4d3 Release 2.1.0
↑↓/jk move • ←→/hl fold • H/L fold all • space toggle • ? help • q quit ↑↓/jk move • ←→/hl fold • ⇧←→/HL fold all • space toggle • ? help • q quit
``` ```
| Area | Height / width | | Area | Height / width |
@@ -183,8 +183,8 @@ colors in components.
| `space` | Toggle expand/collapse of the selected submodule | | `space` | Toggle expand/collapse of the selected submodule |
| `→` / `l` | Collapsed with children: expand and select the first child. Expanded: select the first child. Leaf: nothing | | `→` / `l` | Collapsed with children: expand and select the first child. Expanded: select the first child. Leaf: nothing |
| `←` / `h` | Expanded: collapse it (stays selected). Otherwise: collapse the parent and select it. Top level: nothing | | `←` / `h` | Expanded: collapse it (stays selected). Otherwise: collapse the parent and select it. Top level: nothing |
| `L` / `ctrl+→` | Expand all; then follow the first child from the selection down to a submodule without children | | `L` / `shift+→` / `ctrl+→` | Expand all; then follow the first child from the selection down to a submodule without children |
| `H` / `ctrl+←` | Collapse all (resets remembered expansion); select the top-level ancestor | | `H` / `shift+←` / `ctrl+←` | Collapse all (resets remembered expansion); select the top-level ancestor |
| `home` / `g`, `end` / `G` | First / last submodule | | `home` / `g`, `end` / `G` | First / last submodule |
| `pgup`, `pgdn` | Move by one screen | | `pgup`, `pgdn` | Move by one screen |
| `?` | Toggle full help | | `?` | Toggle full help |
@@ -210,5 +210,5 @@ is selected, headers above it are shown too.
- `SUBMARINE_ASCII=1`: ASCII symbols (`^ v > v . *`) instead of Unicode. - `SUBMARINE_ASCII=1`: ASCII symbols (`^ v > v . *`) instead of Unicode.
- Many setups capture `ctrl+←/→` (macOS Mission Control, some terminals and - Many setups capture `ctrl+←/→` (macOS Mission Control, some terminals and
multiplexers), so expand/collapse all also work as `L` / `H`, the shifted multiplexers), so expand/collapse all also work as `shift+→/←` and as `L` / `H`, the
vim keys for `→` / `←`. shifted vim keys for `→` / `←` (for terminals that don't report shift+arrows).
+3 -3
View File
@@ -17,8 +17,8 @@ func defaultKeys() keyMap {
Left: key.NewBinding(key.WithKeys("left", "h"), key.WithHelp("←/h", "collapse, parent")), Left: key.NewBinding(key.WithKeys("left", "h"), key.WithHelp("←/h", "collapse, parent")),
Right: key.NewBinding(key.WithKeys("right", "l"), key.WithHelp("→/l", "expand, first child")), Right: key.NewBinding(key.WithKeys("right", "l"), key.WithHelp("→/l", "expand, first child")),
Toggle: key.NewBinding(key.WithKeys(" "), key.WithHelp("space", "toggle")), Toggle: key.NewBinding(key.WithKeys(" "), key.WithHelp("space", "toggle")),
CollapseAll: key.NewBinding(key.WithKeys("ctrl+left", "H"), key.WithHelp("H/ctrl+←", "collapse all")), CollapseAll: key.NewBinding(key.WithKeys("shift+left", "ctrl+left", "H"), key.WithHelp("H/⇧←", "collapse all")),
ExpandAll: key.NewBinding(key.WithKeys("ctrl+right", "L"), key.WithHelp("L/ctrl+→", "expand all")), ExpandAll: key.NewBinding(key.WithKeys("shift+right", "ctrl+right", "L"), key.WithHelp("L/⇧→", "expand all")),
Home: key.NewBinding(key.WithKeys("home", "g"), key.WithHelp("home/g", "first")), Home: key.NewBinding(key.WithKeys("home", "g"), key.WithHelp("home/g", "first")),
End: key.NewBinding(key.WithKeys("end", "G"), key.WithHelp("end/G", "last")), End: key.NewBinding(key.WithKeys("end", "G"), key.WithHelp("end/G", "last")),
PageUp: key.NewBinding(key.WithKeys("pgup"), key.WithHelp("pgup", "page up")), PageUp: key.NewBinding(key.WithKeys("pgup"), key.WithHelp("pgup", "page up")),
@@ -37,7 +37,7 @@ func defaultKeys() keyMap {
func (k keyMap) ShortHelp() []key.Binding { func (k keyMap) ShortHelp() []key.Binding {
move := key.NewBinding(key.WithKeys("up"), key.WithHelp("↑↓/jk", "move")) move := key.NewBinding(key.WithKeys("up"), key.WithHelp("↑↓/jk", "move"))
fold := key.NewBinding(key.WithKeys("left"), key.WithHelp("←→/hl", "fold")) fold := key.NewBinding(key.WithKeys("left"), key.WithHelp("←→/hl", "fold"))
all := key.NewBinding(key.WithKeys("H"), key.WithHelp("H/L", "fold all")) all := key.NewBinding(key.WithKeys("H"), key.WithHelp("⇧←→/HL", "fold all"))
return []key.Binding{move, fold, all, k.Toggle, k.Help, k.Quit} return []key.Binding{move, fold, all, k.Toggle, k.Help, k.Quit}
} }