Skip to content

ctrl+l restores terminal modes; drop the focus redraw - #300

Merged
smarzban merged 1 commit into
mainfrom
fix/ctrl-l-restore
Nov 14, 2026
Merged

smarzban merged 1 commit into
mainfrom
fix/ctrl-l-restore

Conversation

@smarzban

Copy link
Copy Markdown
Owner

Why

When a terminal hides a pane and then rebuilds it, the board can come back as scattered text that ignores clicks. T3 Code's panel does this: it replays a trimmed output log, which loses the screen and the input modes tsk set at startup. ctrl+l already redrew the screen, but the mouse stayed off. This PR makes ctrl+l the one recovery key and drops the parts that only existed for T3 Code. It replaces #299.

What changed

  • ctrl+l enters the alternate screen again, sends mouse, paste and keyboard modes again, then redraws every cell. The keyboard flags are popped before the push, so the flag stack doesn't grow.
  • Focus reporting is removed, along with the redraw when the pane gets focus back. It didn't help in T3 Code, and it redrew the whole board on every pane switch.
  • The keys page, the Help label and the changelog line match.

Scope

Done when

# Result Proved by Proof Step
1 ctrl+l sends every mode again and redraws in full, without asking for the cursor position agent Verification 1, 2 5
2 Focus reporting is never turned on, and focus in does nothing agent Verification 1, 3 5
3 No refresh on a timer agent the diff 4
4 The keys page, Help and changelog match agent the diff; the Help width test passes 4
5 In T3 Code, ctrl+l brings a reopened board back whole and clickable owner run this build in T3 Code, hide and reopen the panel, press ctrl+l, click a row

Verification

Commit: 42d8491

  1. cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test, plus cargo clippy --all-targets --target x86_64-pc-windows-gnu -- -D warnings
    2428 passed, 0 failed; both clippy runs clean
    
    With input.restore() commented out by hand, ctrl_l_restores_the_modes_and_a_screen_the_host_terminal_dropped fails.
  2. A PTY smoke that replays only the tail of the board's output into a new terminal, the way T3 Code rebuilds its panel. It runs on scratch state (TSK_STATE_DIR, TSK_CONFIG_DIR and HOME in a temporary folder).
    wait:   tail 980 bytes  | mouse=False altscreen=False | replayed screen: PARTIAL
    ctrl-l: tail 3645 bytes | mouse=True  altscreen=True  | replayed screen: FULL (matches live)
    
  3. The same smoke, startup output, then a focus-in report sent to the board:
    focus ?1004h at startup: False
    after focus-in: only the normal idle paint (cursor hide and reset codes), no redraw
    

Could break

Every terminal gets one change: tsk no longer asks for focus reports, so no terminal sends them. ctrl+l was already reserved on every screen by #297.

Review

The Pi review panel ran on 42d8491 with 8 seats (holistic, tests, spec conformance and correctness, each on sol and opus). It returned one finding.

  • F-1 (medium, set aside): no unit test covers the one line in the event loop that calls the redraw. Smoke 2 drives ctrl+l through the real event loop and shows the full redraw, so the wiring is covered.

ctrl+l now re-enters the alternate screen and sends mouse, paste and
keyboard modes again before the full redraw, so a host terminal that
dropped them (T3 Code's hidden panel) gets a clickable board back.

Focus reporting and its redraw on focus in are removed: they did not
help in T3 Code and redrew the whole board on every pane switch.
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
herdr-tsk Ready Ready Preview Nov 14, 2026 6:20pm UTC

@smarzban
smarzban merged commit d1430bf into main Nov 14, 2026
10 checks passed
@smarzban
smarzban deleted the fix/ctrl-l-restore branch November 14, 2026 18:33

This branch was successfully deployed

1 active deployment
Preview — 42d84912 Deployed Nov 14, 2026 by vercel[bot]
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