Skip to content

fix: prevent Branch column from being dropped on narrow terminals - #1626

Merged
max-sixty merged 2 commits into
mainfrom
fix/branch-column-priority
Mar 19, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/branch-column-priority

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Add shrinkable flag to ColumnSpec — shrinkable columns degrade gracefully to whatever width fits (down to header width) instead of being dropped entirely when their ideal width doesn't fit
  • Mark Branch as the only shrinkable column, so branch names are always visible even on narrow terminals or in the picker's side-by-side layout
  • The mechanism is general (any column could opt in) but only Branch needs it — keeping the change minimal

Before: On a 60-column terminal with Right layout (30 cols for list), if the longest branch name exceeded ~26 chars, the Branch column was dropped entirely — showing Status/HEAD± columns instead, which is what @armstrjare's screenshot in #1564 showed.

After: Branch shrinks to fit the available space, truncated with … by the existing truncate_visible() renderer. Branch names are always visible.

Test plan

  • New unit test test_try_allocate_with_min_width — verifies ideal→min fallback behavior
  • New unit test test_branch_column_never_dropped — verifies Branch is present at 30 cols with a long branch name
  • All 467 unit tests pass
  • Pre-existing integration test failures confirmed on main (not introduced by this PR)

Spun off from discussion in #1564 (comment by @max-sixty).

🤖 Generated with Claude Code

The column allocator used all-or-nothing allocation: if a column's ideal
width (longest branch name) didn't fit, the column was dropped entirely.
This caused Branch names to disappear on narrow terminals or in the
picker's side-by-side layout.

Add a `shrinkable` flag to ColumnSpec. Shrinkable columns gracefully
degrade to whatever width is available (down to header width) instead of
disappearing. Only Branch uses this flag — keeping the change minimal
while the mechanism is general enough for future use.

Closes #1563 (column allocation aspect)

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing due to clippy::collapsible_if — the nested if let + if should be collapsed. Pushing a fix.

Comment thread src/commands/list/layout.rs Resolved
@max-sixty
max-sixty enabled auto-merge (squash) March 19, 2026 21:08
@max-sixty
max-sixty merged commit 953e174 into main Mar 19, 2026
22 checks passed
@max-sixty
max-sixty deleted the fix/branch-column-priority branch March 19, 2026 21:12
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.

2 participants