Skip to content

fix(render): keep poster grid on cell renderers; add ascii/ansi256/truecolor modes#94

Merged
detain merged 1 commit into
masterfrom
ai/poster-grid-cell-modes
Jun 27, 2026
Merged

fix(render): keep poster grid on cell renderers; add ascii/ansi256/truecolor modes#94
detain merged 1 commit into
masterfrom
ai/poster-grid-cell-modes

Conversation

@detain

@detain detain commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Follow-up to the --mode work, addressing two issues you hit.

1. Sixel "got messed up"

The poster rails are composed as text cells (cards stitched side by side, line by line). A graphics protocol (sixel/kitty/iTerm2) emits one opaque DCS/escape blob with no per-row structure — stitching it beside other cards injects cell-padding spaces into the middle of the sequence and shreds it. On a sixel-capable terminal, auto-probe even picked sixel, so the grid broke with no way out.

Fix: run resolves posters via MosaicFactory::forPosterGrid():

  • cell modes (halfblock/quarterblock/ascii/ansi256/truecolor) tile → pass through
  • null/auto default to half-block (no probing into a graphics protocol)
  • an explicit graphics mode → falls back to half-block with a printed notice (single images via phlix poster <img> --mode=sixel still use sixel — one image emits fine)

2. --mode=ascii said "invalid" though it was listed

candy-mosaic had no ASCII renderer (only the video lib did), and ascii / ansi are genuinely different from half-block, not aliases. With the new candy-mosaic renderer (sugarcraft#1119) wired in:

mode what it is
halfblock (≡ ansi) 24-bit colour half-blocks (▀) — the default
quarterblock denser colour blocks (▘▝▖▗)
ascii monochrome character ramp
ansi256 256-colour character ramp
truecolor 24-bit-colour character ramp
sixel/kitty/iterm2 graphics — single images only, not the grid

All five cell modes tile, so they work in the grid. Help/usage now lists the real modes grouped cell vs graphics.

PosterLoader keys its cache by protocol(), so every mode caches separately. MosaicFactoryTest covers each mode's protocol, grid pass-through, and the graphics downgrade notice. Full suite green (2217); src PHPStan L9-clean.

🤖 Generated with Claude Code

…ruecolor modes

Two problems with forcing a render mode for the tiled poster rails:

1. Sixel (and kitty/iTerm2) "got messed up": a graphics protocol emits one
   opaque DCS/escape blob, but the rails are composed as text cells (cards
   stitched side by side, line by line). Stitching a blob beside other cards
   injects cell-padding spaces into the middle of the sequence and shreds it.
   On a sixel-capable terminal auto-probe even picked sixel, so the grid broke
   with no override.

2. `--mode=ascii` errored as "invalid" though it was listed in help — candy-mosaic
   had no ascii renderer (only the video lib did), and ascii/ansi are genuinely
   distinct from half-block, not aliases.

Fixes:
 - `run` resolves posters via MosaicFactory::forPosterGrid(): cell modes
   (halfblock/quarterblock/ascii/ansi256/truecolor) tile and pass through;
   null/auto default to half-block (no probing into a graphics protocol); an
   explicit graphics mode falls back to half-block and prints a notice (single
   images via `phlix poster` still honour it).
 - Wire the new candy-mosaic ASCII/ANSI renderers: `ascii` (mono),
   `ansi256`, `truecolor`; `ansi` and `half` alias half-block (the 24-bit
   colour-block mode). `quarterblock` now uses the new Mosaic::quarterBlock().
 - Help/usage list the real modes, grouped cell vs graphics.

PosterLoader keys its cache by protocol(), so every mode caches separately.
MosaicFactoryTest covers each mode's protocol, grid pass-through, and the
graphics downgrade notice.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@detain detain merged commit 4655334 into master Jun 27, 2026
2 checks passed
@detain detain deleted the ai/poster-grid-cell-modes branch June 27, 2026 15:48
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