Skip to content

fix: worktree list columns misaligned when name/branch exceeds fixed width #10

Description

@notdp

Description

The wt list output columns become misaligned when worktree names or branch names exceed the fixed column widths.

Example

📁 my_project
   └─ ~/Developer/work/my_project
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ▶ main          main               e6e738f   my_project
  • feishu-notification feature/feishu-notification e6e738f   my_project.feishu-notification

Root Cause

In bin/messages.sh, the list_global_worktree_entry message uses fixed-width printf format:

printf '  %s %-13s %-18s %-8s  %s' "$marker" "$name" "$branch" "$hash" "$path"
  • Column 2 (name): %-13s - but "feishu-notification" is 18 chars
  • Column 3 (branch): %-18s - but "feature/feishu-notification" is 27 chars

Affected Lines

  • bin/messages.sh:647 (English)
  • bin/messages.sh:1488 (Chinese)

Possible Solutions

  1. Increase fixed widths - Simple but may still break with very long names
  2. Dynamic column sizing - Calculate max width per column before printing
  3. Truncate with ellipsis - Keep fixed width but truncate long values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions