feat(term): add sixel rendering and propagate terminal pixel size to PTY
Summary
This PR adds Sixel support in Wave terminal rendering and propagates terminal pixel dimensions (xpixel/ypixel) end-to-end so image tools relying on TIOCGWINSZ.ws_xpixel/ws_ypixel can place images correctly.
Fixes https://github.com/wavetermdev/waveterm/issues/2172
Changes
-
Frontend:
- Enable Sixel via
@xterm/addon-image(sixelSupport: true,enableSizeReports: true). - Add terminal pixel-size capture (
xpixel/ypixel) from terminal viewport. - Send pixel size together with rows/cols on resize, resync, restart, and terminal-state cache paths.
- Enable Sixel via
-
Shared types:
- Extend
TermSizewith optionalxpixel/ypixel.
- Extend
-
Backend:
- Propagate
xpixel/ypixelinto PTY winsize (pty.Winsize{Rows, Cols, X, Y}) for start + resize paths. - Update shell/job resize flows to compare and apply pixel-size changes.
- Keep SSH behavior char-based (
WindowChange(rows, cols)), unchanged.
- Propagate
Why
Some image clients (e.g. PixelTerm-C) depend on PTY pixel metrics for cell geometry. Previously Wave only updated rows/cols, which could cause image positioning offsets.
Validation
- Built backend/frontend successfully.
- Verified
wavesrvstartup with updated build. - Verified related Go packages compile/test cleanly.
Compatibility
xpixel/ypixelare optional; existing behavior remains when pixel size is not provided.
[!NOTE]
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
- [ ] ▶️ Resume reviews
- [ ] 🔍 Trigger review
Walkthrough
This PR adds pixel dimensions to TermSize (xpixel/ypixel in frontend types; XPixel/YPixel in Go) and propagates TermSize usage across frontend and backend. Frontend: termwrap loads an optional sixel ImageAddon, introduces getTermSize(), replaces direct rows/cols access with TermSize, updates types, and adds sharp and @xterm/addon-image deps. Backend: waveobj.TermSize gains pixel fields; ConnInterface.SetSize signatures changed to accept a TermSize; a new ptyutil.WinsizeFromTermSize helper converts TermSize to pty.Winsize and is used in jobmanager, shellexec, blockcontroller, and conn implementations.
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and specifically summarizes the main changes: adding Sixel rendering support and propagating terminal pixel dimensions to the PTY. |
| Description check | ✅ Passed | The description is well-detailed and directly related to the changeset, covering frontend Sixel support, terminal pixel-size capture, shared type extensions, and backend PTY propagation. |
| Linked Issues check | ✅ Passed | The PR successfully implements graphics protocol support (Sixel) as requested in issue #2172, enabling improved image previews in the terminal with proper pixel-size handling for image positioning. |
| Out of Scope Changes check | ✅ Passed | All code changes are directly related to implementing Sixel support and propagating terminal pixel dimensions, with no out-of-scope modifications detected. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Code Review Summary
Status: No New Issues | Recommendation: Merge
Overview
The PR adds sixel image rendering support and propagates terminal pixel dimensions to the PTY. The implementation is solid with proper error handling for the ImageAddon loading.
Previously Identified Issues (Already Addressed)
| Severity | File | Line | Issue |
|---|---|---|---|
| WARNING | pkg/jobmanager/jobcmd.go |
N/A | Code duplication - helper functions defined in multiple files |
| CRITICAL | pkg/shellexec/conninterface.go |
223 | SSH WindowChange - noted as x/crypto API limitation |
| MAJOR | frontend/app/view/term/termwrap.ts |
602 | Pixel-only resizes may be skipped in handleResize |
Files Reviewed (7 files)
frontend/app/view/term/term-model.ts- Refactored to usegetTermSize()frontend/app/view/term/term.tsx- Updated xterm options (overviewRuler → scrollbar)frontend/app/view/term/termwrap.test.ts- New test file for sixel addonfrontend/app/view/term/termwrap.ts- Added sixel support, getTermSize(), viewport scroll trackingfrontend/types/gotypes.d.ts- Added xpixel/ypixel to TermSizepackage.json- Added @xterm/addon-image dependencypackage-lock.json- Dependency updates
Code review completed. No new issues found in this revision.
Reviewed by minimax-m2.5-20260211 · 284,204 tokens
Current support image output by sixel.