fix: align session status tags in their own column - #332
Merged
Conversation
The session state tag (e.g. "[○ Idle]") was appended to the branch name, so it started at a different horizontal position on every row and was hard to scan. Give it its own column, placed directly left of the last commit date, so every row's tag starts at the same position. Because the extra column widens each row, calculateColumnPositions now takes the number of columns the label may occupy and falls back to the previous name-appended layout when the aligned one would not fit. Menu and Dashboard supply that width from the terminal size via the new useAvailableLabelWidth hook. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jf1jf3ZqsXZtMAwwkTkPEc
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.
Problem
The session state tag (
[○ Idle],[● Busy], …) was appended directly to the branch name, so it started at a different horizontal position on every row. Scanning the list for a session's state meant reading each row's tag at wherever the branch name happened to end.Approach
Give the state tag its own column, placed directly left of the last-commit date (
1d ago), so every row's tag starts at the same position.The extra column widens each row, and narrow terminals cannot always afford it. So the layout is chosen per list: the caller passes the number of columns a row label may occupy, and when the aligned layout does not fit, the layout falls back to the previous behavior of appending the tag to the name.
Aligned (wide enough):
Fallback (too narrow for the column):
The tag is left-aligned within its column so the state icons (
○ ● ◐) line up vertically, which is what the eye scans for.Changes
src/utils/worktreeUtils.ts:SessionItemcarries the state tag in a newstatusfield instead of insidebaseLabel;calculateColumnPositionsgained thestatuscolumn, an optional available-width argument, and analignStatusflag reporting which layout it picked;assembleSessionLabelrenders accordingly. Rows showing a git error keep the tag next to the name, since those rows have no columns at all.src/hooks/useAvailableLabelWidth.ts(new): terminal width minus the per-row prefix (the SelectInput indicator plus the number prefix), used as that available-width argument.src/components/Menu.tsx,src/components/Dashboard.tsx: supply the width from the new hook. Dashboard buildsSessionItemvalues by hand as well, so it was updated to the same convention rather than leaving two meanings for one type.Verification
bun run lint,bun run typecheck: clean.bun run test: 1861 passed. The 6 failing files are the pre-existing submodule suites, which fail inbeforeAllongit config --global protocol.file.allow always(could not lock config file /Users/…/.gitconfig: Operation not permitted) in this sandboxed environment — unrelated to this change.src/utils/worktreeUtils.test.tscover the aligned column position, the narrow-terminal fallback, and the git-error row.🤖 Generated with Claude Code