Skip to content

feat: fill the terminal width and redraw on resize#15

Merged
brtkwr merged 1 commit into
mainfrom
feat/responsive-width
Jun 22, 2026
Merged

feat: fill the terminal width and redraw on resize#15
brtkwr merged 1 commit into
mainfrom
feat/responsive-width

Conversation

@brtkwr

@brtkwr brtkwr commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

What

The list was a fixed ~99-column table, so on a wide terminal it left most of the screen empty, and it didn't reflow when you resized the window.

  • TOPIC flexes to fill the width - topicColWidth() derives the topic column from m.width after the fixed columns, so the list spans the whole terminal. The title and search/count lines span the full width too.
  • Redraws on resize - the WindowSizeMsg handler now returns tea.ClearScreen, so shrinking the window doesn't leave stale wider rows behind.
  • The previously hand-synced column widths (16/22/34/5/4/6) are now named constants (colDate, colProject, …) shared by the header and both row formats, so there's one source of truth.

Tests

  • TestTopicColWidthFlexes - the topic column grows with terminal width and clamps to a minimum on tiny terminals.
  • TestFormatListItemFillsWidth - a rendered row's length is exactly width - indent at 80/120/200 columns (i.e. it fills the screen).
  • Existing formatListItem/marker tests updated to set a realistic width.
  • go test -cover = 71.5%.

Note: the resize visual behaviour (clear + reflow) is exercised by the width math in tests; I can't headlessly drive a real terminal resize, but the dynamic widths + tea.ClearScreen are the standard bubbletea approach.

The list was a fixed ~99-column table, so it ignored most of a wide
terminal and didn't reflow when the window changed size.

The TOPIC column now flexes to absorb the full terminal width
(topicColWidth derives from m.width), the title/search lines span the
width too, and a WindowSizeMsg returns tea.ClearScreen so shrinking the
window doesn't leave stale wider rows behind. The hand-synced column
widths are now named constants shared by the header and rows.
@brtkwr brtkwr merged commit 8078494 into main Jun 22, 2026
1 check passed
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