Skip to content

Feature/tui improvements - #71

Open
prem315 wants to merge 10 commits into
canaryfrom
feature/tui-improvements
Open

prem315 wants to merge 10 commits into
canaryfrom
feature/tui-improvements

Conversation

@prem315

@prem315 prem315 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@sanchitrk
sanchitrk changed the base branch from main to canary October 13, 2026 07:50
…iew modules

main.rs was doing five jobs at once — terminal setup, input, key resolution,
rendering and cleanup — which is why the tree could not grow. The previous
attempt at a modular TUI collapsed into a 1,660-line app.rs before c1f1d38
removed it. Give each responsibility its own module so adding a screen is
additive rather than another round of untangling main.

- tui.rs owns the terminal. Raw mode, alternate screen, paste and focus modes
  and the keyboard protocol are switched on in one place and released by one
  idempotent restore(), reached from Drop, the panic hook and normal shutdown,
  so a panic or an early return can no longer strand a shell without echo.
- event.rs reads input on a dedicated thread and translates it into app events,
  dropping key releases so the keyboard protocol cannot fire a key twice.
- action.rs resolves key presses to named actions, reusing OpenCode's ctrl+x
  leader and action names so its bindings carry over. Adds ctrl+d and <leader>q.
- app.rs is the only place state changes; update() reports whether a repaint is
  needed, so an idle TUI does no work and a burst of events costs one frame.
- ui.rs stays pure, which is what will make a frame reproducible from TestBackend.

Renders now run inside a synchronized update so a slow repaint shows one whole
frame. Resize repaints explicitly instead of relying on an incidental redraw.

This branch has not been deployed

No deployments
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