Skip to content

feat(pager): add inline image diff previews - #39

Merged
Blankeos merged 3 commits into
mainfrom
feat/img-vid-binary-preview
Oct 6, 2026
Merged

Blankeos merged 3 commits into
mainfrom
feat/img-vid-binary-preview

Conversation

@Blankeos

@Blankeos Blankeos commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Show Before/After raster image previews in Kitty and Ghostty, with full-width Added/Deleted states.
  • Load images from the worktree, index, or Git revisions; support inline image sections in folder diffs.
  • Decode and resize in the background with resource limits and a striped fallback for unsupported or corrupt files.

Documentation / limitations

README documents supported formats (PNG, JPEG, GIF first frame, WebP, BMP, ICO, TIFF), terminal support, and LAZYGITRS_IMAGE_PREVIEW=off.

Files over 20 MiB, SVG/video, and tmux/screen/Zellij retain placeholders. iTerm2/WezTerm and Sixel support is experimental; whole-commit overviews retain placeholders.

Validation

  • cargo test — 267 passed (after input fix 17af522)
  • cargo fmt --check
  • git diff --check
  • cargo clippy --all-targets — completed successfully, with existing warnings (not warning-clean)

Live terminal rendering was not manually verified in this pass.

Merge confidence — Codex review

8.5/10 (high, still conditional on a live-terminal smoke test). Updated after 17af522; this is a qualitative engineering assessment, not a measured failure probability.

Reviewed only this branch's changes against origin/main. Refactor f327a09 isolated capability probing, bounded source loading, and inline diff eligibility/source selection behind private module seams, with 11 regression tests. Follow-up 17af522 addresses the automated review's P2: genuine Alt+], Alt+P, Alt+^, and Alt+_ are no longer unconditionally discarded along with subsequent input.

Design: the input module retains its existing caller interface. A private recognizer buffers bounded lookahead and suppresses only a complete validated Kitty reply; malformed, incomplete, unrelated, and non-key events are returned in order. The split-APC and already-parsed Alt+_ paths share this implementation; unrelated parser behavior was left alone. No reply state or replay management was added to GUI callers.

Evidence: all 267 local tests pass; formatting and diff checks are clean; Clippy completes with existing warnings. Eight new input tests cover genuine Alt shortcuts, following input, split APC, malformed/truncated candidates, non-key events, success/error replies and both terminator encodings, buffer limits, and the short initial probe. Four regression tests were confirmed failing before the fix. Final read-only review found no blockers in the fix.

Why confidence increased: the known input-loss regression is now addressed and covered, rather than left as a pre-merge issue.

Remaining risk: automated/test-backend coverage does not verify actual terminal graphics, scoped deletion, or overlay cleanup. No live Kitty/Ghostty smoke test was performed; experimental iTerm2/WezTerm/Sixel cleanup remains explicitly unverified. Alt+_ remains inherently ambiguous with APC and uses a short 15 ms initial probe; a genuine keystroke sequence identical to a complete protocol reply cannot be distinguished at this event seam. The reported GitHub checks are release-planning checks with artifact builds skipped, not a substitute for cross-platform build/runtime validation.

Before merging: smoke-test Kitty or Ghostty with a changed image, added/deleted images, mixed text/image folder diffs while scrolling, opening/closing an overlay, the affected Alt bindings followed by ordinary input, and LAZYGITRS_IMAGE_PREVIEW=off fallback. If those pass, I would recommend merging. GitHub repository review/check requirements must also be satisfied before merging.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T19:45:08.184629Z 50c971e PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: 50c971ec4d

ℹ️ 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 src/gui/input.rs Outdated
Comment on lines +196 to +200
if key.kind == KeyEventKind::Press
&& key.modifiers == KeyModifiers::ALT
&& matches!(key.code, KeyCode::Char(']' | 'P' | '^' | '_'))
{
consume_control_string(source, Instant::now() + SEQUENCE_DEADLINE)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve genuine Alt control-introducer keypresses

When a user presses Alt+], Alt+Shift+P, Alt+^, or Alt+_—including via a custom binding such as <a-P>—this branch always treats the key as a terminal control string, discards it, and consumes subsequent input until a terminator or timeout. Since the capability probe runs only during startup, control-string filtering should be limited to an actual pending reply or validate the following payload rather than permanently making these legitimate Alt combinations unusable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Addressed in 17af522. The broad Alt+], P, ^, _ discard is gone. Only Alt+_ uses private, bounded lossless lookahead; a complete validated Kitty reply is suppressed, while malformed/incomplete candidates and unrelated events are returned in order. Split APC uses the same recognizer. The input module's caller interface is unchanged (codebase-design: keep protocol/replay knowledge local at the existing input seam).

Added eight regression tests; four were confirmed failing before the fix. All 267 tests pass, cargo fmt --check and git diff --check pass, and Clippy completes with existing warnings. Live-terminal smoke testing remains outstanding and is documented in the updated merge-confidence section.

- Render Before/After previews for PNG, JPEG, GIF, WebP, BMP, ICO, and TIFF in Kitty and Ghostty, with Added/Deleted full-width states backed by worktree, index, and revision blobs
- Add background decode with memory/dimension limits, 20 MiB cap, and striped binary fallback for unsupported terminals, oversized files, and corrupt images
- Support capped inline image sections in folder diffs across split/unified and wrapped views with viewport-driven loading and cache-aware unloading
- Add diff path parsing for quoted/renamed headers, terminal graphics protocol handling, `LAZYGITRS_IMAGE_PREVIEW` opt-out/experimental flags, and tmux/screen/Zellij fallback
@Blankeos
Blankeos force-pushed the feat/img-vid-binary-preview branch from 50c971e to 09fc1bb Compare October 6, 2026 09:33
@Blankeos
Blankeos merged commit a84188f into main Oct 6, 2026
6 checks passed
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.

1 participant