Repository navigation
refactor(tui): move terminal I/O out of run/mod.rs - #522
Merged
Merged
Conversation
run/terminal.rs now holds the terminal the loop draws on: opening the console, raw mode and the alternate screen, reading events, drawing, the panic restore and putting everything back (62 items). run/mod.rs drops from 2914 to 2077 lines; it was 6690 before #519. What is left is the run loop and small helpers. A pure move: the only textual changes are `pub(super)` on the moved items and on the 18 methods of LoopIo and LoopTerm, plus two signatures rustfmt re-wrapped. CONSOLE_WRITE_BUFFER stays in mod.rs, where the memory budget pins it. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merged
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.
What
Last step of splitting
crates/tui/src/run/mod.rs(after #519, #520, #521).run/terminal.rsnow holds the terminal the loop draws on: opening the console, raw mode and the alternate screen, reading events, drawing, the panic restore, and putting everything back (62 items:LoopIo,LoopTerm,TuiWriterand the free functions around them).run/mod.rsdrops from 2914 to 2077 lines; it was 6690 before #519. What is left is therunloop and small helpers. The loop is orchestration over shared local state and already calls helpers for nearly every step, so I am not planning to split it further.It is a pure move
Compared line by line against
main(ignoring order): the only differences arepub(super)on the moved items and on the 18 methods ofLoopIoandLoopTerm, two signatures rustfmt re-wrapped, and themod/uselines.CONSOLE_WRITE_BUFFERstays inmod.rs, wherescripts/memory_budget.jsonpins it.Verification
cargo clippy -p whycodes-tui --all-targets -- -D warnings,cargo fmt --all --check, all budget scripts: green.cargo test -p whycodes-tui --lib: 1503 passed, 0 failed.cargo build -p whycodes-cli: ok.main: both debug builds were driven in a Windows pseudo console (ConPTY, 120x40) with an isolatedWHYCODES_HOME: first paint, Esc to skip the key dialog, typing into the prompt,/help,/exit. Both exit with status 0 and print the session summary. The rendered screens are the same apart from the rotating hint line, and the set of mode sequences is identical: alternate screen on/off (?1049), cursor hide/show (?25), bracketed paste on/off (?2004), mouse on/off (?1003;1006), focus reports (?1004), title push/pop (22;0t/23;0t), cursor shape set and reset.docs/tui-term-matrix.md(Unix emulators, macOS Terminal.app) were not run.🤖 Generated with Claude Code