CPLAT-9497: preserve preview selection across detail modes#30
Merged
gavin-jeong merged 2 commits intomasterfrom Apr 21, 2026
Merged
Conversation
Make compact preview selectable, group standard preview artifacts near their related turns, and preserve the nearest logical block when switching compact, standard, and verbose detail modes.
Kairo-Kim
approved these changes
Apr 20, 2026
The standalone `ccx images` picker had zero Kitty integration, so the
inline image never rendered outside the conversation split. In addition,
two bugs made Kitty rendering unreliable even where it did fire:
- Every render invoked ExtractImageToTemp, which wrote a fresh temp file
per call. Hundreds of stale jpegs piled up and Kitty never got a
stable file path to load. Fixed by persisting the decoded image into
the shared ~/.claude/image-cache/<sessionID>/<pasteID>.png so the
path is stable across renders, re-encoding non-PNG sources (JPEG/GIF)
into PNG to match Kitty's f=100 protocol.
- tmux `allow-passthrough on` drops DCS passthrough from a hidden pane,
so a clear sequence emitted after a window switch never reaches the
terminal and the image lingers over the next window. Promote the
option to `all` during kitty.Supported() so invisible-pane clears get
through, then poll tmux #{window_active} on a 250ms tick (both in the
main TUI and the standalone picker) to detect window switches — tmux
does not forward focus events for intra-session window changes, so
BlurMsg alone is not enough. The poll writes the clear sequence to
os.Stdout the instant we transition to invisible.
Also: picker now handles tea.WindowSizeMsg with InvalidatePaneOffset(),
and the conv view kittyImageLayer path was simplified to share a single
kittyImagePath resolver that always goes through the persistent cache.
Tests added:
- internal/cli/picker_kitty_test.go: image-only kind, blur clear, happy
draw, missing-file clear.
- internal/session/image_cache_test.go: JPEG source re-encodes as PNG
and returns a stable cache path across calls.
Kairo-Kim
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA: https://sendbird.atlassian.net/browse/CPLAT-9497
Summary
Preview UX (original scope):
Kitty inline image rendering (added):
ccx imagespicker now renders the focused image inline (was text-only)~/.claude/image-cache/<sessionID>/<pasteID>.pngso Kitty sees a stable pathf=100is PNG-onlyallow-passthroughtoallso clear sequences can escape a hidden pane, and poll#{window_active}on a 250ms tick to detect window switches (tmux does not forward focus events for intra-session window changes)Test plan
go test ./...(366 passing)go test ./internal/tui -run 'TestCompactPreviewBuildsSelectableFoldState|TestCompactPreviewArrowKeysMoveBlockSelection|TestModeSwitchPreservesNearestSelection|TestBuildStandardEntryPlacesArtifactsNearRelatedText|TestRenderStandardPreviewShowsArtifactNearRelatedTurn'go test ./internal/cli -run Kittygo test ./internal/session -run ExtractImageToTempJPEGccx imagesrenders inline image, survives pane resize, clears on tmux window switch