Description
Redrawing a transparent iTerm2 inline image at the same cursor position leaves the previous image visible underneath it. This causes stale graph lines to accumulate when scrolling in Serie with --protocol iterm.
Remove existing iTerm image placements at the same anchor before placing the replacement image, after validating the incoming image. Images anchored elsewhere and Kitty image placements are preserved.
Linked Issue
Fixes #16586
- The linked issue is labeled
ready-to-specorready-to-implement. - Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).
The linked issue has a standalone reproduction and is labeled bug and repro:high. This is a reproducible bug fix submitted directly as a code PR under the contribution guide.
Testing
Tested on macOS 15.7.3 (Apple Silicon) with Rust 1.92.0.
cargo nextest run --locked -p warp_terminal: 560 passed, 2 existing ignored tests skipped.cargo clippy --locked -p warp_terminal --all-targets --tests -- -D warnings: passed../script/format: passed.- Temporarily removing the image eviction call causes all three replacement regression tests to fail because the old image IDs remain. The fix was restored before running the full crate test suite.
Added regression coverage for:
-
Repeated images at the same position, including replacement with a narrower image and the resulting cursor position.
-
Preserving images anchored at different rows or columns.
-
Preserving Kitty image placements at the same position.
-
Preserving the previous image and cursor position when a zero-width replacement is rejected.
-
I have manually tested my changes locally with
./script/run
Built the local app with ./script/run --features iterm_images --dont-open and opened the resulting WarpOss.app.
| Check | Observed result |
|---|---|
python3 probe.py --mode none, using the script attached to #16586 | Stage A shows the red shape. Stage B shows only the cyan shape; the previous red shape disappears without writing spaces. |
python3 probe.py --mode space | Stage B shows only the cyan shape. |
serie -i head --protocol iterm, Serie 0.10.0 in the Warp repository | Scrolled with Ctrl-E 12 times; old graph lines did not accumulate. |
Screenshots / Videos
Before
After
https://github.com/user-attachments/assets/4cc2314d-1ceb-4ad9-837a-dff2b4f93ec2
The before screenshot is from the original Warp recording in #16586. The after screenshots and approximately 18-second Serie recording show the local build based on master commit 1e6c3ae465d6a925a9b97ae03877aaadd159b8f1 with this fix applied.
Agent Mode
- Warp Agent Mode - This PR was created via Warp's AI Agent Mode
Changelog Entries for Stable
CHANGELOG-BUG-FIX: Fixed stale inline images remaining visible when applications redraw images using the iTerm2 image protocol.
Activity
6I tried to sign the CLA at https://cla.warp.dev/, but submitting it returns:
“Sign request failed (500): Failed to record signature. Please try again.”
Could you please check the CLA service?
@cla-bot check
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @lomavkin on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.
The cla-bot has been summoned, and re-checked this pull request!
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @lomavkin on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment
@cla-bot checkto trigger another check.