Skip to content

fix: text-spacing in diff overlay and help menu#95

Merged
delianides merged 5 commits into
mainfrom
drew/fix-text-spacing
May 30, 2026
Merged

fix: text-spacing in diff overlay and help menu#95
delianides merged 5 commits into
mainfrom
drew/fix-text-spacing

Conversation

@delianides
Copy link
Copy Markdown
Collaborator

@delianides delianides commented May 30, 2026

Summary

Fixes two TUI spacing bugs:

  • Diff overlay line numbers collided past 4 digits. The gutter used two fixed 4-wide columns ({:>4}{:>4} ) separated only by alignment padding, so a 5+ digit line number overflowed the field and the old/new numbers ran together as "one long digit." Added a gutter_width pre-scan that sizes both columns to the file's largest line number, and a format_gutter helper that always keeps a single-space separator. Narrow files stay compact; large files never collide.
  • Help menu keys misaligned. Keys were padded to a fixed 14 chars, but several (Ctrl+u / Ctrl+d, gg / G / Ctrl+u/d/f/b) exceed that and overflowed, breaking the description column. Now computes a global key-column width from the widest key by terminal display width (via fit::display_width, so arrow glyphs are measured correctly) plus a 2-column gap.

Pure spacing — no new glyphs, colors, layout changes, or config options.

Test Plan

  • cargo test — 356 pass (10 new: 5 format_gutter, 3 gutter_width, 2 help alignment)
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo build --release — succeeds
  • Visual check: open a diff touching line numbers ≥ 10000 — old/new numbers visibly separated and columns aligned
  • Visual check: press ? — all descriptions start at the same column, including the longest key rows

🤖 Generated with Claude Code

delianides and others added 5 commits May 29, 2026 20:54
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@delianides delianides merged commit 52f8cb2 into main May 30, 2026
9 checks passed
@delianides delianides deleted the drew/fix-text-spacing branch May 30, 2026 01:57
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.

1 participant