Skip to content

terminal: clip Sixel and iTerm payloads to final viewport geometry #389

Description

@subinium

Priority: P2
Evidence: Source-verified; real decoder/viewport reproduction required
Baseline: v0.23.0 source 37933f9, audited 2026-09-05. Native execution/compile probes used Rust 1.98.0 on aarch64 macOS unless explicitly stated otherwise.

Problem and Reproduction

Sixel/iTerm images are encoded before layout. Partial viewport clipping changes the recorded rect/footprint but does not crop or resize the encoded payload. A20x4 image in a 2-row scroller can therefore emit more image area than tracked as visible.

src/context/widgets_display/rich_output.rs:368 · src/buffer.rs:631

Scope

  • Carry source data/geometry to final placement, then crop or encode for the actual visible area.
  • If a protocol cannot represent the required crop safely, use a defined fallback instead of emitting the full payload.
  • Keep damage footprints and exposed-cell clearing equal to what the terminal actually receives.

Expected Effect

Prevent images from painting over neighboring panes and leaving stale pixels after scrolling.

Acceptance Criteria

  • Top/left/right/bottom and two-axis nested clipping cases match the intended visible image.
  • Move/resize/remove partially visible images without painting outside viewport or leaving stale damage.
  • Use a decoder-aware fixture and actual supported terminal; envelope-only escape assertions are insufficient.
  • Follow the repository quality gates and the evidence rules in tracking: post-v0.23 correctness, resource efficiency and WASM completion #366; record actual results rather than treating a proposed test as passed.

Boundaries and Dependencies

Do not claim all terminals implement the same crop controls; protocol-specific handling is part of scope.

No blocking implementation dependency identified; coordinate shared code with the tracker.

Related closed work: #265. This is a scoped follow-up at the audit baseline, not a claim that every prior fix is absent.

Tracking: #366. This issue records unresolved work, not an implemented fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:widgets-displayDisplay widgets (text, image, etc.)bugSomething isn't workingseverity:criticalIncorrect logic or significant bugtype:bugCorrectness: panic, wrong logic, unexpected behavior

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions