Skip to content

feat: pane.rename names a pane, like tabs and spaces - #384

Open
abhijit-s wants to merge 8 commits into
herdrdev:masterfrom
abhijit-s:feat/pane-rename
Open

abhijit-s wants to merge 8 commits into
herdrdev:masterfrom
abhijit-s:feat/pane-rename

Conversation

@abhijit-s

Copy link
Copy Markdown
Contributor

For #322.

Spaces and tabs can be renamed, panes can't. A tab with three shells in it shows three headers that all read "zsh", and a layout that wants named panes has to keep the name somewhere of its own (#322: a terminal label written through a copy of the prompt mod) and draw it in its own header.

pane.rename {pane?, name} works like tab.rename (it takes pane, as the other pane commands do): the pane defaults to the focused one, a person running it without a name gets the shipped prompt (pre-filled with the current name), and an empty name goes back to the program's own. The name is kept as the title of the pane's block in its tab's tree, so it is saved and shared with the tab's layout document the same way tab names are, panes on another machine keep theirs, swapping or moving a pane takes its name along, and documents saved before this load with no names. Mod panes can be named too.

panes() gives each pane's name (null when unset). The shipped pane and terminals-pane headers show it before the agent's name or the terminal's title. defaults/AGENTS.md, herdr.d.ts and the generated command reference list the command and the field.

#322 asks for terminal.rename. I went with the pane rather than the core terminal so the name lives where tab and space names live, in the layout document, with no core change. The trade-off is that hc ls doesn't show it, and agents() doesn't carry it yet; happy to switch or add either if you prefer.

No default key: f2 and shift-f2 rename the tab and the space, and I didn't find an obvious third. Something like alt-f2, or a "Rename" entry in the pane's right-click menu, could follow if you want one.

Tested on macOS 27.2 arm64: just check passes (24 bun tests, 280 cargo tests, 2 ignored), including new tests for naming and clearing a pane, the document round trip to another machine, and an older document without names; just docs-check passes. In a running build, pane.rename named a pane, its header and panes() picked the name up, an empty name cleared it, and an unknown pane id is refused (no pane "nope"). Not tried: a pane on a remote machine beyond the document test. Not tested on Linux or Windows; the change is platform-independent.

Several shells in one tab all read "zsh" in their headers, and only spaces and tabs could be renamed. The name is kept as the title of the pane's block, so it is saved and shared with the tab's layout document like tab names, and older documents load without one. panes() gives it as name, and the shipped pane headers prefer it.

Refs herdrdev#322
abhijit-s pushed a commit to abhijit-s/herdr-app that referenced this pull request Nov 3, 2026
@M1racleShih

Copy link
Copy Markdown

Thanks for working on pane naming, @abhijit-s.

I tried be3219e locally and noticed a possible follow-up in the shipped Agents mod. With two agents in a tab named Shared task and panes named API and UI, both sidebar rows still show Shared task; labels currently resolve through lead(tab).

I have a small local patch that matches each row to its actual pane ID and uses an explicit pane name before the existing tab/live-title fallback. It includes test-first render/interaction regressions and a short guide update, with no Core or shared API changes. I checked it in the isolated Linux sandbox using local status/title fixtures.

Would a small PR against your feat/pane-rename branch be helpful, or would you prefer a separate follow-up after this lands? I'm happy to adjust the naming precedence to match your intended behavior. This would only build on your pane-renaming work, not replace it.

@abhi-easygo

Copy link
Copy Markdown

Thanks @M1racleShih, good catch. Yes please, open it as a PR against feat/pane-rename and I'll merge it into this one. The precedence you describe matches what I intended: an explicit pane name first, then the tab name, then the live title.

@M1racleShih

Copy link
Copy Markdown

Opened abhijit-s/herdr-app#1 against feat/pane-rename as suggested. Thanks for the guidance—happy to adjust the patch further if useful.

abhijit-s and others added 2 commits November 4, 2026 22:09
fix: use each agent's pane name in the sidebar
# Conflicts:
#	defaults/mods/agents/main.js
#	scripts/agents.test.ts
@abhijit-s

Copy link
Copy Markdown
Contributor Author

TL;DR: the Agents sidebar now uses each agent's own pane name (then the tab name, then its live title), thanks to @M1racleShih's companion fix (abhijit-s#1), now merged into this branch. Also merged master to stay current with #485 (one pane read per render is kept).

@abhijit-s

Copy link
Copy Markdown
Contributor Author

TL;DR: merged master (45 commits) to clear the conflicts; agent rows now follow a167060 after an explicit pane name.

  • Agents sidebar: a167060 already labels agents that share a tab by each agent's own title. This branch keeps one thing on top: an agent's pane name, when set, comes first (defaults/mods/agents/main.js). Without one, rows read exactly as on master. The companion fix's "pane's live title" path is replaced by a167060's, since both solved the same thing.
  • Tests: four scripts/agents.test.ts cases written for the old fallback now expect a167060's (a cleared pane name in a shared tab reads the agent's title; a missing pane reads its own agent's title). The guide line in defaults/AGENTS.md names the shared-tab rule.
  • Other conflicts: pane.swap {pane?, direction | target} (feat: let pane.swap swap two panes by id with target #665) sits beside pane.rename in the guide, the malformed-target test and needs_model_pane.
  • just check passes locally on macOS.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants