feat: (optional) arrow-key pane focus and hide gesture - #348
Conversation
81bb926 to
5f8c632
Compare
|
hmm, I don't think I like this to be honest. tried it out locally and I prefer just using the leader for swapping focus |
5f8c632 to
db7d2a2
Compare
|
Yeah, tab works too for that and it might just be sufficient. I was trying to capture what |
bdca239 to
92d1788
Compare
84d2a94 to
12100d4
Compare
When `arrow_tree_navigation = true`, `h` / `l` in the file list fall through to gitui-style tree nav at the horizontal scroll boundary: - `l` on a collapsed folder expands it; on an expanded folder descends to the first child; on a file jumps to the next folder below. - `h` on an expanded folder collapses it; otherwise ascends to the parent. At the top level it jumps to the previous folder above. Default is `false` so `h` / `l` stay as plain horizontal scroll, matching vim's character navigation. Folders are still expandable with `Enter` / `Space` regardless of the flag. With the flag on, moving the file-list cursor (`j` / `k`, arrows, or the tree-nav keys above) to a file also scrolls the diff to that file's header without changing focus. Folders are a no-op so arrowing past collapsed entries leaves the diff viewport alone. Enter still commits the selection and shifts focus. Horizontal scroll keeps the sticky prefix (indent, expand icon, checkbox, status badge) anchored at the left edge; only the filename portion slides. Scroll caps at "at least one column visible" so a name never disappears entirely. Leaving the file list resets `scroll_x` to 0. New `App::file_list_select_parent` / `_select_next_folder` / `_select_prev_folder` walk the visible tree to the relevant entry. `App::auto_jump_to_selected_file_if_enabled` syncs the diff to the file-list cursor when the flag is on. ADR: docs/decisions/FEAT-0014 Folder Expansion.md
Builds on FEAT-0014's `arrow_tree_navigation` flag (default off). When the flag is on, `h` / `l` slide focus between the file list and the diff at the horizontal scroll boundary, mirroring the gitui mental model. The default is unchanged: `h` / `l` stay as plain horizontal scroll, matching vim's character navigation. - diff: `h` at `scroll_x == 0` slides focus to the file list (revealing it if hidden) when the flag is on; otherwise scrolls. - file list: `l` at `max_scroll_x` on a file slides focus to the diff when the flag is on; otherwise scrolls. Folders fall through to the tree-nav rules from FEAT-0014. ADR: docs/decisions/FEAT-0012 Arrow Navigation.md
12100d4 to
f71d81c
Compare
|
Closing in favor of two narrower changes:
The remaining slide-focus-between-panes behavior lives on in my fork at N4M3Z#3 for personal use; happy to re-propose upstream as a smaller PR if there's appetite once #370 lands. |
Stacked on top of #370 (opt-in folder expansion). Adds slide-focus-between-panes and the optional second-press hide gesture, all gated by the same
arrow_tree_navigationflag (default off).Note
This depends on #370 being merged first. Default behaviour is unchanged for vim users --
h/lstay as horizontal scroll.hatscroll_x == 0slides focus to the file list (revealing it if hidden) whenarrow_tree_navigation = true. Otherwise plain horizontal scroll.latmax_scroll_xon a file slides focus to the diff whenarrow_tree_navigation = true. Tree-nav behaviours on folders come from feat: (optional) arrow folder expansion in the file tree #370.scroll_x = 0reset on leaving the file list are unconditional.right_arrow_hides_file_list = trueenables a press-release-press collapse: the slide arms it, a Right Release sets the gate, a fresh Right Press in the diff collapses the file list. Held keys never satisfy the gate. Requires kittyREPORT_EVENT_TYPESto be useful.Test plan
cargo fmt && cargo clippy -- -D warningscleanh/las plain horizontal scrollarrow_tree_navigation = true,hin the diff atscroll_x = 0slides focus to the file list (and reveals it if hidden)lon a file in the file list slides focus to the diffscroll_xresets to 0 after focus moves awayright_arrow_hides_file_list = true, deliberate release+press oflin the diff collapses the file list; heldldoes not