Repository navigation
Redraw the whole board on focus in and ctrl+l - #297
Merged
Merged
Conversation
A host terminal that drops its alternate screen while the pane is hidden (T3 Code's terminal on panel switches) left the board showing only the cells that changed since the last frame. Enable focus reporting and clear ratatui's frame on FocusGained or ctrl+l so the next paint writes every cell.
Terminal::clear asks the terminal for the cursor position and errors out of the board when no answer comes. Resizing to the current size clears the screen and resets the back buffer without that query.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Some host terminals drop the board's alternate screen while the pane is hidden. T3 Code's terminal panel does this when you switch away and back. ratatui then repaints only the cells that changed since its last frame, so the board comes back as scattered ages and counts on a blank pane. tsk now asks for focus reports and repaints every cell when focus returns, or on
ctrl+l.What changed
?1004h) and turn it off on exit (src/ui/mouse.rs).FocusGainedorctrl+lresets ratatui's frame before any surface sees the event, so the next paint writes every cell (forget_frame_on_repaint_requestinsrc/app.rs). It usesTerminal::resizeto the current size, notTerminal::clear, becauseclearasks for the cursor position. A terminal that doesn't answer that question made the board exit with an error during the live smoke.ctrl+lrow and a note inkeys.md, a Help row, and a CHANGELOG Fixed line.Scope
ctrl+lredraw key on every surface, text entry included.Terminal::clear.Done when
focus_reporting_is_enabled_and_restored; smoke 1repaint_request_restores_a_screen_the_host_terminal_dropped; smoke 1ctrl+ldoes the samerepaint_request_never_queries_the_cursor_position(fails withterminal.clear()); smoke 1ctrl+lVerification
Commit: 6d58b30 (smoke 1 ran on the binary from 5edae4a. 6d58b30 changes only tests.)
TSK_STATE_DIR,TSK_CONFIG_DIRandHOMEunder/tmp. It runs the board in a 100×30 pty fed to apytescreen, wipes the emulator's screen, sends focus in (ESC [ I), then wipes it again and sendsctrl+l:Terminal::clearin place of the fix, the same smoke ended the board withtsk: The cursor position could not be read within a normal duration, because pyte doesn't answer the query.cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test: 2428 passed, 0 failed. Alsocargo clippy --all-targets --target x86_64-pc-windows-gnu -- -D warningsandcd site && npm test, both clean.Could break
Every focus-in now clears and repaints the screen once, so a slow terminal might flicker briefly. On Windows, crossterm treats the focus-reporting commands as no-ops, and focus events arrive anyway.
Review
Pi review panel (gpt-6.1-sol and opus-5-5; holistic, tests, specification-conformance) on 5edae4a: 6 of 6 seats voted. Holistic and spec seats found nothing. Kept F-3/F-2 (no test failed on a cursor query), fixed in 6d58b30, and the opus seat's verify passed.
Set aside: F-1/F-4. Nothing tests the one line that hooks the repaint into the event loop. Covering it would mean pulling a step out of
run_board_loop, and the PTY smoke covers that line end to end.