tui: replace custom image renderer with ratatui-image #117
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#117
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 images to render correctly in any graphics-capable terminal (Kitty, Sixel, iTerm2, or halfblock fallback), so that gallery detail, generate preview, and entity reference images work reliably.
Problem
The custom Kitty renderer (
image/kitty.rs) writes escape sequences to a buffer flushed afterterminal.draw(). This causes positioning issues — ratatui has already flushed its buffer and moved the cursor, so Kitty cursor positioning collides with ratatui's state. Images don't appear despite the renderer being detected.Solution
Replace the custom
ImageRenderertrait +kitty.rs/sixel.rs/chafa.rs/halfblock.rsbackends withratatui-image, which renders images as native ratatui widgets. This eliminates the stdout synchronization problem entirely.Acceptance criteria
Core
ratatui-imageas a dependencyImageRenderertrait withratatui-image'sPicker+StatefulProtocolAppCtxholds aPickerinstead ofArc<Mutex<Box<dyn ImageRenderer>>>StatefulProtocolin its stateStatefulImagewidget insideframe.render_stateful_widget()flush_pending()from the render loop — no longer neededimage/kitty.rs,image/sixel.rs,image/chafa.rs,image/halfblock.rsimage/detect.rs—ratatui-image::Pickerhandles protocol detectionProtocol support
tui.tomlimage_protocoloverride still respected (map toratatui-imageprotocol selection)Image handling
imagecrate handle format detection)Tests
MockRendererintesting.rsto match new APIOut of scope
References
ratatui-imagerepo: https://github.com/ratatui/ratatui-imagecrates/loom-tui/src/image/(to be replaced)crates/loom-tui/src/screens/gallery.rsrender_detail()crates/loom-tui/src/screens/generate.rscrates/loom-tui/src/app.rs