feat(tmux): keep window indices gap-free (renumber-windows on)#28
Merged
Conversation
When a cook window closed — killed, or auto-dropped when its agent process exits — the survivors kept their original indices, leaving a hole (e.g. 0, 2, 3). That broke the manual's promise that `prefix+<n>` jumps to the nth cook. Add `set -g renumber-windows on` to tmux.conf so tmux renumbers the survivors on any window close: the head chef stays at 0 and cooks stay 1, 2, 3… contiguously. yeschef addresses windows by name, never index, so this is invisible to send/peek/kill — it only fixes the human's tab order and prefix+<n> navigation. Add an e2e test (spawn 3 cooks, kill the middle one, assert the survivors renumber to 0,1,2 with the last cook sliding into the freed slot) and document the behavior in DEVELOPMENT.md's tmux notes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
set -g renumber-windows ontotmux.confso the brigade's windowindices stay gap-free.
Why
When a cook window closed — whether killed with
yeschef kill, orauto-dropped when its agent process exits (tmux's default, see the
Liveness note) — the surviving windows kept their original indices,
leaving a hole. Killing the middle of
0,1,2,3left0,1,3. Thatbreaks the kitchen manual's promise that
prefix+<n>jumps to the nthcook, and leaves the tab bar visually ragged.
renumber-windows onmakes tmux renumber the survivors on any windowclose, so the head chef stays at window 0 and the cooks stay
1, 2, 3…contiguously.
Safe by construction
yeschef addresses every window by name (
yeschef:<window>), never byindex (
WindowInfodoesn't even carry an index). So renumbering isinvisible to
send/peek/kill/status— it only fixes the human'stab order and
prefix+<n>navigation.Testing
killing_a_middle_cook_reindexes_windows_gap_free:spawns 3 cooks (
0,1,2,3), kills the middle one, and asserts thesurvivors renumber to
0,1,2with the last cook sliding into thefreed slot. Verified it fails (
0,1,3) with the option off, provingit's a real regression guard.
nix flake checkgreen (fmt, nixfmt, clippy, unit tests).20 passed).All tmux work was done on throwaway per-test sockets — never the live
yeschefserver.