Skip to content

refactor(leantui): poll terminal size in the event loop - #4696

Merged
dgageot merged 2 commits into
mainfrom
refactor/leantui-resize-loop
Oct 22, 2026
Merged

dgageot merged 2 commits into
mainfrom
refactor/leantui-resize-loop

Conversation

@dgageot

@dgageot dgageot commented Oct 22, 2026

Copy link
Copy Markdown
Member

Why

The lean TUI's resize handling relied on a dedicated goroutine, a channel,
and a cached-size variable just to react to terminal resizes. Separately,
PTY race tests surfaced a preexisting shutdown race: canceling input could
race with restoring the terminal, since the reader's Read wasn't joined
before Close/restore ran.

What

  • fix(leantui): join the canceled input goroutine before restoring the
    terminal, closing the cancelreader Read/Close shutdown race.
  • refactor(leantui): poll terminal size directly in the main event loop
    (every 250ms) instead of a separate goroutine/channel/cache, updating all
    callers accordingly. Removes two goroutines and a channel.

Validation

  • task build, task test, task lint: clean on this branch (built on
    top of current main).
  • go test ./pkg/leantui/... -race: passing.
  • Cross-compiled for linux/amd64 and windows/amd64.

@dgageot
dgageot requested a review from a team as a code owner October 22, 2026 08:00
@dgageot
dgageot added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit e81eb97 Oct 22, 2026
16 checks passed
@dgageot
dgageot deleted the refactor/leantui-resize-loop branch October 22, 2026 08:20
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