Skip to content

Fixes #5459. Integrated sixel raster output, improved ImageView and scenarios#5460

Merged
tig merged 15 commits into
developfrom
tig/sixel-integration-plan
Jun 2, 2026
Merged

Fixes #5459. Integrated sixel raster output, improved ImageView and scenarios#5460
tig merged 15 commits into
developfrom
tig/sixel-integration-plan

Conversation

@tig
Copy link
Copy Markdown
Member

@tig tig commented Jun 1, 2026

Summary

  • Integrate sixel raster output into IOutputBuffer/OutputBase, including clipping-aware composition and pre-encoded sixel reuse for full visible raster images.
  • Route ImageView sixel drawing through the output buffer and fix first-render/card sizing issues across sixel and cell-based rendering.
  • Add focused ImageView keyboard handling: arrow/scroll keys are consumed, panning works when zoomed, PageUp zooms in, PageDown zooms out, and zoom-out can shrink to a 1x1 rendered image.
  • Add optional background rendering for ImageView; async rendering scales and sixel-encodes off the UI thread, keeps the last completed frame visible, and shows an Aesthetic2 SpinnerView while work is pending.
  • Enable async rendering by default in the UICatalog Images scenario with a checkbox toggle, and refine related image palette/scenario code.
  • Split ImageView into focused partials under Terminal.Gui/Views/ImageView/ and colocate backing fields with their properties or first use.
  • Ignore generated *.actual snapshot artifacts and remove the accidentally committed snapshot output.

Tests

  • dotnet build Terminal.Gui --artifacts-path ...\isolated-build-artifacts
  • dotnet build Examples\UICatalog --artifacts-path ...\isolated-build-artifacts
  • dotnet test --project Tests\UnitTestsParallelizable --filter-class "*ImageViewTests" --artifacts-path ...\isolated-test-artifacts
  • dotnet test --project Tests\UnitTestsParallelizable --filter-class "*OutputBaseTests" --artifacts-path ...\isolated-test-artifacts
  • GitHub Actions CI/CD is running on the latest pushed commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd87e87ccd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Terminal.Gui/Drivers/Output/OutputBase.cs Outdated
@tig tig changed the title Fixes #5459. Prototype integrated sixel raster output Fixes #5459. Integrated sixel raster output Jun 1, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates sixel raster output into the normal output-buffer composition path (with clip capture), routes ImageView sixel rendering through this buffer, and adds a UICatalog scenario to exercise clipping/overlay behavior.

Changes:

  • Added RasterImageCommand and new raster-image APIs on IOutputBuffer with storage in OutputBufferImpl.
  • Updated OutputBase to render raster images during Write() and to include them in ToAnsi() output.
  • Updated ImageView to emit sixel via the output buffer (and added a new Mandelbrot UICatalog scenario for interactive testing).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Tests/UnitTestsParallelizable/Drivers/Output/OutputBaseTests.cs Adds tests for raster-image clip capture, ANSI emission, skip-on-non-intersection, and ordering vs later dirty cells.
Terminal.Gui/Views/ImageView.cs Switches sixel rendering from the out-of-band queue to IOutputBuffer.AddRasterImage(); removes old cached-queue state.
Terminal.Gui/Drivers/Output/RasterImageCommand.cs Introduces a command object describing raster images for buffered composition.
Terminal.Gui/Drivers/Output/OutputBufferImpl.cs Stores raster image commands and captures clip; marks covered cells clean to avoid redundant redraw.
Terminal.Gui/Drivers/Output/OutputBase.cs Renders raster images as part of output composition and appends raster-image output in ToAnsi().
Terminal.Gui/Drivers/Output/IOutputBuffer.cs Adds raster image APIs (AddRasterImage, RemoveRasterImage, GetRasterImages).
Examples/UICatalog/Scenarios/Mandelbrot.cs Adds an interactive Mandelbrot sixel scenario with overlay dialog to exercise clipping/composition.

Comment thread Terminal.Gui/Drivers/Output/OutputBufferImpl.cs
Comment thread Terminal.Gui/Drivers/Output/OutputBufferImpl.cs
Comment thread Terminal.Gui/Drivers/Output/OutputBufferImpl.cs
Comment thread Terminal.Gui/Drivers/Output/OutputBase.cs Outdated
tig and others added 7 commits June 1, 2026 06:25
Add regression coverage for raster command IDs, stale cell invalidation, and ToAnsi layering. Update raster buffer replacement/removal to dirty stale image cells and make ToAnsi emit raster images before text overlays.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tig added a commit to tig/winprint that referenced this pull request Jun 1, 2026
…output

Switch Terminal.Gui from NuGet (2.4.3) to local project reference targeting
the tig/sixel-integration-plan branch (gui-cs/Terminal.Gui#5460) which
provides integrated raster image output with proper clipping, Z-order, and
invalidation.

Removed from PreviewPane:
- Mouse drag-to-pan (GrabMouse/UngrabMouse, position tracking)
- Scroll-wheel and keyboard zoom (+/-/0)
- SuspendSixel/ResumeSixel dialog workaround
- Manual pixel-budget calculation (Frame * cell-size assumptions)
- MaterializeSample fallback helper

Removed from PageRenderer:
- Zoom, PanX, PanY properties and associated transform math

Removed from MainView:
- RunnableOpening/RunnableClosed → SuspendSixel/ResumeSixel wiring

Deleted:
- ImageLoader.cs (dead code)
- Resources/preview-sample.png (unused fallback asset)

Also includes prior uncommitted work:
- fix: settings changes now update preview (SettingsChanged subscription)
- fix: sheet change reloads file (SheetApplied handler)
- UI border/thickness/scheme tweaks and comment cleanup
- Regenerated all 11 golden snapshots

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tig and others added 4 commits June 1, 2026 16:32
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig tig changed the title Fixes #5459. Integrated sixel raster output Fixes #5459. Integrated sixel raster output, improved ImageView and scenarios Jun 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 35 changed files in this pull request and generated 6 comments.

Comment thread Terminal.Gui/Input/Command.cs
Comment thread Terminal.Gui/Input/Command.cs
Comment thread Terminal.Gui/Drivers/Output/OutputBufferImpl.cs
Comment thread Terminal.Gui/Views/ProgressBar.cs
Comment thread Examples/UICatalog/Scenarios/Images/Images.cs
Comment thread Terminal.sln.DotSettings Outdated
tig and others added 2 commits June 1, 2026 18:19
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@BDisp BDisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is truly an excellent implementation. I only noticed a change in the image colors when the border of a dialog box is overlapped, as shown in the image below. You might also want to update Mandelbrot.gif to the current appearance.

Image

@tig tig merged commit 27bdcf0 into develop Jun 2, 2026
13 checks passed
@tig tig deleted the tig/sixel-integration-plan branch June 2, 2026 01:35
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.

3 participants