tui: smart dirty tracking — avoid constant full-screen redraws #124
Labels
No labels
area:agents
area:ai
area:config
area:dashboard
area:design
area:design-review
area:devtools
area:entities
area:gallery
area:generate
area:image
area:infra
area:meta
area:model-browser
area:navigation
area:presets
area:security
area:sessions
area:settings
area:sharing
area:test
area:ux
area:webhook
area:workdir
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/loom#124
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a user, I want the TUI to be snappy and low-CPU even when idle, so that it doesn't waste resources redrawing unchanged content every 250ms.
Problem
App::process_event()setsself.dirty = trueon every event (line 403 in app.rs), including every 250ms tick. This causes a full terminal redraw 4 times per second even when the UI hasn't changed. On slow terminals or over SSH, this causes visible flicker and unnecessary bandwidth.ratatui's
Terminal::draw()does diff-based rendering (only changed cells are written), but the diff computation itself has a cost, and protocol-level image renderers (Kitty/Sixel) may re-transmit image placements.Acceptance criteria
dirtyby default — only events that actually change state doEvent::Key,Event::Mousewith state changes setdirty = trueEvent::CoreMsgsetsdirty = true(backend state changed)Event::Resizesetsdirty = trueAppAction::Redraw(already exists)AppAction::Redrawon their update interval instead of relying on tickImplementation approach
Replace the blanket
self.dirty = trueat line 403 with per-event-type logic:Out of scope
References
crates/loom-tui/src/app.rs—process_event()line 403,self.dirty = truecrates/loom-tui/src/event.rs—Eventenum, tick intervalTerminal::draw()compares previous and current buffer