3.2 KiB
3.2 KiB
06. Rewire keybinds — h/l drill+pop, digits switch tabs, focus starts on current
meta: id: yazi-remake-06 feature: yazi-remake priority: P1 depends_on: [yazi-remake-01, yazi-remake-05] tags: [implementation, keybinds, tests-required]
objective:
- Rewire the Shell dispatch so the sidebar's special-cased j/k branch is gone, h/l drill/pop on depth-tabs and swipe on fixed tabs, digit keys +
[ ]are the sole tab switcher, and app focus starts on the current pane.
deliverables:
src/components/Shell.tsx(dispatch) —SIDEBAR_ACTIONSset + theif (nav.activePane() === SIDEBAR_PANE)branch deletedh/lunified: depth-tabsl=current-drills (openemit),h=current-pops (noop at depth 0); fixed-pane tabsh/l=swipe(∓1, count)1-6/tab-goto-*,tab-next/tab-prev([/]) — the only tab switchers- Initial focus + tab-enter land on
DEPTH_CENTER_PANE keybinds.jsoncreviewed (update labels/help only if needed)
steps:
- Read the current
dispatch()(post task 01 it references a deletedSIDEBAR_PANE— fix the compile here) - Remove the
SIDEBAR_ACTIONSconstant and its branch - In the
defaultcase, implement: digit/tab-goto →setActiveTab;swipe-prev→ (depth-tab & current & depth>0)popDepthelse (depth-tab & current & depth==0) noop elseswipe(-1, count);swipe-next→ (depth-tab & current) emitopenelseswipe(1, count) - Move/list actions (
move-down/up,jump-*,page-*,goto-top/bottom) flow toPAGE_ACTIONS→emit("nav.action")for the current pane only - Confirm
escape/command/visual-mode/toggle-select/audio/global branches unchanged - Verify the app boot path sets focus to current (task 01 set the signal; confirm dispatch doesn't override)
- Run diagnostics + harness key sequence
tests:
- Unit:
dispatch("move-down")on a depth-tab current pane emitsnav.action {action:"move-down"}(Arrange current pane, Act, Assert emit) - Integration:
dispatch("swipe-next")on a depth-tab at depth 0 emitsopen(drill);dispatch("swipe-prev")at depth 1 pops to depth 0; at depth 0swipe-previs a noop - e2e (harness):
ldrills (depth 0→1, parent populates),hpops (1→0, parent blanks),1/2/3switch tabs,j/kmove the current list cursor without changing depth
acceptance_criteria:
- No
SIDEBAR_PANEorSIDEBAR_ACTIONSreferences inShell.tsx hat depth 0 is a noop (does not error, does not change pane)lat current on a depth-tab drills (depth+1)- Digit keys switch tabs; focus lands on current pane
j/kmove within current only
validation:
grep -n "SIDEBAR" src/components/Shell.tsxreturns nothinglens_diagnosticspaths=[src/components/Shell.tsx] severity=error → 0 findings- Harness:
init(focus on current) →l(depth 1, parent filled) →l(depth 2) →h(depth 1) →h(depth 0, parent blank) →3(Discover tab, focus on current) →j/kmove
notes:
- Depends on 01 (pane model:
swipebounds, no SIDEBAR) and 05 (dispatch lives in the rebuilt Shell) - If
keybinds.jsonchas atab-next/tab-prevmapping conflict, resolve here - The noop
hat depth 0 should feel inert (yazi: at root,hdoes nothing)