feat(tui): image rendering — chafa backend + half-block fallback #56
No reviewers
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!56
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tui/chafa-14"
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?
Summary
Adds the two "works anywhere" image backends so Phase 2 has a guaranteed terminal fallback. Stacks on #55. Closes charles/loom#14.
What's in
image::chafa::ChafaRenderer— shells out tochafa --format=symbols --size=WxH --colors={256|full}(full under$COLORTERM=truecolor|24bit) and prints the output at the rect.ChafaRenderer::detect()returnsErr(ChafaNotFound)when the binary isn't on$PATH, so#15can fall throughimage::chafa::HalfBlockRenderer— pure-Rust fallback decoding the input via theimagecrate and emitting▀glyphs with 24-bit ANSI fg/bg sampled from pairs of vertical pixels. Always availablerender_halfblocks— pure function exposed for tests; takes PNG bytes and target cell dimensions, returns a ready-to-print ANSI blockprint_block_athelper that cursors to each target row before emitting a lineTests (2 new, 53 total)
halfblocks_produce_deterministic_output_for_fixed_fixture— same input twice → same output, contains▀and\x1b[0mchafa_detect_returns_not_found_with_empty_path— with$PATHcleared,ChafaRenderer::detect()errors out. Usesunsafe { std::env::set_var }with restore to play nicely with the global envAdds the two "always available" image backends called for by spec §2.2: - image::chafa::ChafaRenderer — shells out to the chafa binary with --format=symbols --size=WxH --colors={256|full depending on COLORTERM} and prints the resulting ANSI/UTF-8 block at the target rect. Returns ChafaNotFound when the binary isn't on PATH so auto-detect can fall through - image::chafa::HalfBlockRenderer — pure-Rust fallback using U+2580 half-blocks with 24-bit ANSI fg/bg derived from image-crate pixel sampling. Always available, always deterministic Both share the same print_block_at helper that walks a pre-formatted block of text lines and cursors to each target row before emitting. Closes charles/loom#14 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>