Skip to content

Sixel auto-detection in tmux causes silent rendering failure at large terminal widths #327

@gwpl

Description

@gwpl

Summary

chafa 1.18.0 auto-detects sixel support when running inside tmux (Konsole terminal). At larger terminal widths, the sixel output silently fails to render — the image is completely invisible. At smaller terminal widths, the same image renders correctly.

Environment

  • chafa 1.18.0 (Arch Linux)
  • tmux 3.5a
  • Konsole (KDE terminal emulator)
  • TERM=xterm-256color, COLORTERM=truecolor

Reproduction

# Generate test image
magick -size 400x300 gradient:red-blue /tmp/test.png

# Inside tmux in Konsole (window ~70 columns wide):
chafa --size 70 /tmp/test.png    # ✅ Renders correctly
chafa --size 200 /tmp/test.png   # ❌ Image invisible — nothing displayed

# Force symbols mode — works at ALL sizes:
chafa -f symbols --size 200 /tmp/test.png   # ✅ Always works

# Force sixels explicitly — fails at large size:
chafa -f sixels --size 200 /tmp/test.png    # ❌ Fails same as auto-detect

Observed behavior

--size Auto-detected format Output bytes Renders?
40 sixel 42,790 ✅ Yes
70 sixel 199,139 ✅ Yes
100 sixel 403,894 ✅ Yes
130 sixel 675,674 ⚠️ Sometimes
160 sixel 1,021,665 ❌ No
200 sixel 1,442,439 ❌ No

Confirmed via hexdump that chafa outputs DCS sixel sequences (ESC P 0;1;0q...) even without -f sixels — it auto-selects sixel when the terminal reports sixel support.

All sizes work correctly with -f symbols.

Impact on downstream consumers

Applications that shell out to chafa and pipe its stdout (or use stdio: inherit) assume chafa outputs ANSI-colored Unicode half-blocks. The undocumented switch to sixel format breaks these consumers because:

  1. The output format is different (DCS sequences vs ANSI + Unicode)
  2. Sixel output requires tmux DCS passthrough wrapping that consumers don't know to apply
  3. There's no way to detect which format chafa chose without parsing the output

Our workaround is to force -f symbols when invoking chafa.

Related issues

Expected behavior

Either:

  1. chafa should not auto-select sixel format in tmux when large payloads will fail to render, OR
  2. The auto-detected format should be documented/queryable so consumers can handle it, OR
  3. chafa should handle tmux DCS passthrough wrapping internally when it detects tmux (similar to how viu does)

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityCompatibility (e.g. terminal quirks)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions