Skip to content

Add PR diff panel and side-by-side diff viewer#11

Merged
bluestreak01 merged 1 commit intomasterfrom
vi_gh
Apr 4, 2026
Merged

Add PR diff panel and side-by-side diff viewer#11
bluestreak01 merged 1 commit intomasterfrom
vi_gh

Conversation

@bluestreak01
Copy link
Copy Markdown
Member

@bluestreak01 bluestreak01 commented Apr 4, 2026

Summary

  • PR Diff Panel (Ctrl+D): Tree view of files changed in the current PR, grouped by directory with expand/collapse, status indicators (+/●/−/→), quick search with Up/Down cycling, and session persistence
  • Side-by-Side Diff Viewer: Full-file diff with syntax highlighting, text selection + clipboard copy, search with highlighting, hunk-level navigation (Alt+Up/Down), terminal caret on both panels with Tab switching, and F4 editor toggle with viewport preservation
  • PanelFocus enum refactor: Replaced 5 separate *_focused fields with a single enum, eliminating a class of focus-state bugs

New files

  • src/pr_diff.rs — PR diff panel state, git integration, tree building
  • src/diff_viewer.rs — Side-by-side diff viewer state, unified diff parsing, selection, search
  • src/ui/diff_view.rs — PR diff panel renderer (tree with status icons)
  • src/ui/diff_viewer_view.rs — Side-by-side diff renderer (syntax colors, selection highlight, search matches, caret)

Diff viewer

image

PR Changelist

image

Test plan

  • cargo clippy -- -D warnings passes
  • cargo fmt -- --check passes
  • cargo test — 346 tests pass (33 new tests covering tree building, diff parsing, navigation, selection, search, and rendering helpers)
  • Manual testing: Ctrl+D opens panel, Enter opens diff viewer, F4 toggles editor, Esc returns, n/N/Alt+arrows navigate hunks, Ctrl+F searches, Shift+arrows select, Ctrl+C copies, Tab switches sides, mouse click positions caret

🤖 Generated with Claude Code

Adds two major features for PR code review:

**PR Diff Panel (Ctrl+D)**
- Tree view of files changed in the current PR
- Grouped by directory with expand/collapse
- File status indicators (Added/Modified/Deleted/Renamed)
- Quick search: type to filter, Up/Down to cycle matches
- Persisted across sessions

**Side-by-Side Diff Viewer**
- Full-file diff with base branch (via git merge-base)
- Syntax highlighting on both panels
- Text selection (Shift+arrows) and clipboard copy (Ctrl+C)
- Search with match highlighting (Ctrl+F, n/N)
- Hunk navigation (Alt+Up/Down) skips to next/prev diff hunk
- Terminal caret on either panel, Tab to switch sides
- F4 toggles to editor at current line (Esc returns)
- Viewport position preserved across editor/viewer transitions

**Architecture improvements**
- Replaced 5 separate focus fields with single PanelFocus enum
- Extracted focused_side() helper for bottom panel resize logic
- Bottom panel key/action intercepts guarded by mode check
- 346 tests (33 new covering tree building, diff parsing,
  navigation, selection, search, and rendering helpers)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bluestreak01 bluestreak01 merged commit 7e72d64 into master Apr 4, 2026
@bluestreak01 bluestreak01 deleted the vi_gh branch April 6, 2026 05:50
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