Skip to content

Ctrl+hjkl navigation broken on herdr 0.7.0 (pane-id format + focus API changes) #1

Description

@ctbaum

Summary

herdr-navigator no longer navigates between panes on herdr 0.7.0 — every focus/dispatch exits non-zero and focus never moves. herdr.nvim is at current main (deed849). herdr's own herdr pane neighbor / herdr pane focus CLI work fine, so the live layout/state is healthy — it's the helper's assumptions about 0.7.0 that broke. There are two independent incompatibilities.

1. Pane-id format — pane_public_mapping

It builds public ids as "{workspace_id}-{index+1}" (e.g. w3-1):

.map(|(index, internal_id)| (internal_id, format!("{workspace_id}-{}", index + 1)))

But herdr 0.7.0's public pane ids are "{workspace}:p{number}" (e.g. w3:p3) — the form used by pane.list, pane.current, HERDR_ACTIVE_PANE_ID, etc. So internal_id_from_pane_id("w3:p3", …) never matches the generated w3-1/w3-2/…, then falls through to "w3:p3".parse::<i64>() (fails) → Nonefocus_adjacent returns Ok(1). Every pane lookup fails, so all navigation is dead.

The correct internal→public mapping is already in session.json on the workspace as public_pane_numbers, e.g.:

"public_pane_numbers": { "10": 3, "9": 2, "14": 6, "8": 1 }

i.e. for each internal id, build format!("{workspace_id}:p{public_number}") using public_pane_numbers[internal].

2. Focus API — focus_pane / focus_adjacent

The agent.focus shim (report_agentagent.focusrelease_agent) no longer moves focus on 0.7.0 — the RPCs succeed but server focus doesn't change. AGENTS.md notes the shim exists "since Herdr has no direct pane.focus API", but 0.7.0 added one: pane.focus_direction, with params { "pane_id": "<id>", "direction": "left|right|up|down" }. It computes the neighbor and focuses it server-side in a single call (it's what herdr pane focus --direction uses), which also makes the session.json layout math unnecessary for focusing.

Environment

  • herdr 0.7.0 (Homebrew, macOS / Apple Silicon)
  • herdr.nvim main @ deed849

Repro

With ≥2 panes in a tab, Ctrl+h/j/k/l doesn't move between panes. From a shell:

HERDR_ACTIVE_PANE_ID=<a-pane-id> HERDR_ACTIVE_TAB_ID=<its-tab-id> herdr-navigator focus left; echo $?
# -> exits 1, no focus change

(herdr pane neighbor --direction left --pane <a-pane-id> returns the correct neighbor, confirming the live layout is fine.)

Proposed fix

Both are small: derive ids from public_pane_numbers ({ws}:p{n}), and have focus_adjacent call pane.focus_direction (falling back to the existing computed path if the RPC is unavailable, for older herdr). I've applied exactly this locally and navigation is fully restored.

Happy to open a PR if that's welcome — just let me know your preference and I'll run it through the repo's cargo fmt / clippy / pre-commit checks first. Thanks for the plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions