Skip to content

feat: full-file diff view, two-pane diff tab, and git sidebar enhancements#232

Open
yashas-salankimatt wants to merge 16 commits intomarcus:mainfrom
yashas-salankimatt:diff-view-enhancements
Open

feat: full-file diff view, two-pane diff tab, and git sidebar enhancements#232
yashas-salankimatt wants to merge 16 commits intomarcus:mainfrom
yashas-salankimatt:diff-view-enhancements

Conversation

@yashas-salankimatt
Copy link
Contributor

Summary

  • Full-file diff view in git plugin with syntax-highlighted rendering and scrollable minimap for navigation
  • Two-pane diff tab in workspace plugin with commit drill-down, untracked file support, persistent adjustable split (drag to resize), and narrow terminal collapse
  • Git sidebar enhancements: +/- line stats on all file entries (staged, modified, untracked, commit files) and expandable scrollable commit body in preview

Key Changes

Git Plugin

  • Full-file diff view mode with unified diff parsing and syntax highlighting
  • Minimap overlay for quick navigation in large diffs
  • +/- line count stats next to sidebar file entries (including folder aggregation for untracked files)
  • Expandable commit body: press k at topmost file to expand full message, scroll with j/k, collapse with esc
  • Panic guard for narrow terminals in commit preview

Workspace Plugin

  • Two-pane diff tab: file list on left, diff preview on right with commit drill-down
  • Untracked files shown in diff tab
  • Persistent adjustable split width via mouse drag
  • Auto-collapse to single pane on narrow terminals
  • Minimap integration in diff tab full-file view
  • Per-segment styling restoration and full-width padding for file/commit entries

Test plan

  • Open git plugin, verify +/- stats appear next to modified/staged/untracked files
  • Click into a commit, verify +/- stats on commit files
  • Press k at topmost commit file to expand body, scroll with j/k, collapse with esc/j
  • Switch to diff tab, verify two-pane layout with file list and diff preview
  • Click a commit in diff tab to drill down into its files
  • Drag the split divider to resize panes, verify persistence across restarts
  • Resize terminal to narrow width, verify collapse to single pane
  • Open full-file diff view, verify minimap appears and syncs with scroll
  • Verify no panics on very narrow terminals

🤖 Generated with Claude Code

yashas-salankimatt and others added 13 commits March 13, 2026 07:11
Add a third diff view mode (full-file side-by-side) alongside unified and
split views. This shows the complete old and new file content side-by-side
with change highlighting, similar to VS Code's diff editor.

- Add BuildFullFileDiff() to construct full-file diffs from old/new content
- Add RenderFullFileSideBySide() for rendering full-file diffs
- Add NextChange()/PrevChange() for navigating between changes (n/N keys)
- Add loadFullFileDiff() async loader for both inline and full-screen views
- Update scroll clamping, view rendering, and breadcrumb for the new mode
- Cycle through modes: unified → split → full-file (v/V keys)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the single scrollable diff view with a two-pane hierarchical layout
matching the git plugin's interaction model:

- Left pane: file list with status icons (+/-) and commits section
- Right pane: per-file diff viewer with unified/split/full-file modes
- j/k navigate files, l/enter drills into diff, h/esc goes back
- Commit hover shows file list preview in right pane
- Commit drill-down: left=file list with commit info, right=file diff
- v/V cycles view modes, n/N jumps between changes, {/} jumps files
- Default split ~25% file list, ~75% diff viewer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Include untracked files in the workspace diff view by generating synthetic
new-file diffs. Uses git ls-files --others --exclude-standard to discover
untracked files, then creates diff output via gitstatus.GetNewFileDiff()
so they appear alongside tracked file changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allow drag-to-resize the file list vs diff viewer split in the diff tab.
The width is saved to state.json and restored across sessions.

- Add DiffTabFileListWidth to state with getter/setter
- Register mouse hit region on the diff tab divider
- Handle drag events with pixel-based width updates and clamping
- Track lastDragRegion to correctly dispatch persistence on drag end
  (mouse handler clears drag state before the DragEnd event)
- Compute effective width at drag start when no saved preference exists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the diff tab content width is below 120 columns, switch from the
two-pane side-by-side layout to a single-pane hierarchical view. This
makes the diff tab usable in vertical/narrow terminal configurations.

Navigation works the same way — l/enter drills down one level, h/esc
goes back up — but only one level is shown at a time using the full
available width.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a VS Code-style minimap alongside the full-file diff viewer showing
diff density with colored markers and a viewport position indicator.
Known issue: viewport indicator can desync from actual scroll position.

- Half-block Unicode encoding (▀) for 2× vertical resolution
- Color-coded diff markers (green=add, red=remove, gray=context)
- Bright/dim variants for inside/outside viewport
- Purple rail (▐) showing current viewport position
- Mouse click on minimap to jump to file location
- Scroll clamping on j/k to prevent scrolling past EOF
- Works in full-screen modal, two-pane, and sidebar diff views
- Skipped when line wrapping is enabled (line count mismatch)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ormulas

G key, ctrl+d, and full-file-diff-loaded handlers used (height-2) for
maxScroll while clampDiffScroll used (height-4), allowing scroll 2 lines
past the true maximum. This caused the minimap viewport indicator to
show an incorrect position. Replace all inline maxScroll calculations
with calls to the centralized clamp functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e scroll clamping

- Replace ▐ rail with half-block characters (▀/▄/█) that encode
  per-slot viewport membership, eliminating the visual desync between
  the rail and the bright/dim boundary of the map cells
- Replace all remaining inline maxScroll calculations in mouse.go
  and plugin.go with calls to clampDiffScroll()/clampDiffPaneScroll(),
  fixing height-6 vs height-4 inconsistency between mouse and keyboard
- Add debug logging via slog.Debug for minimap diagnostics (--debug flag)
- Add tests for viewport > file, negative totalLines, half-block rail
  boundary, and viewEnd exceeding totalLines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…to full width

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yashas-salankimatt
Copy link
Contributor Author

Here are some screenshots of the features in action:

Full File Diff- like VS Code:
Screenshot 2026-03-13 at 7 13 34 AM

Better Diff Viewer Experience in Workspace Tab- like sidecar git plugin:
Screenshot 2026-03-13 at 7 17 23 AM

@yashas-salankimatt
Copy link
Contributor Author

Expandable Commit Messages in Git Plugin:
Screenshot 2026-03-13 at 7 18 29 AM

+/- Line Change numbers in Git Plugin View for easier viewing of change scope:
Screenshot 2026-03-13 at 7 23 02 AM

@yashas-salankimatt
Copy link
Contributor Author

yashas-salankimatt commented Mar 13, 2026

These three PRs were developed together and should be merged in order:

  1. feat: full-file diff view, two-pane diff tab, and git sidebar enhancements #232 (diff view enhancements) — base for the other two
  2. feat: split terminal panel with Ctrl+T toggle #233 (terminal panel) — builds on feat: full-file diff view, two-pane diff tab, and git sidebar enhancements #232
  3. fix: interactive mode scroll reset and tab guard #234 (interactive mode fixes) — builds on feat: full-file diff view, two-pane diff tab, and git sidebar enhancements #232

Together they represent a large bump to sidecar's diff viewing, agent output inspection, and workspace management capabilities.

…ommitStatusHeader)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@marcus
Copy link
Owner

marcus commented Mar 13, 2026

Hey @yashas-salankimatt! Starling here (AI assistant on the project). 👋

Three coordinated PRs in one morning — this is a serious drop. Let me summarize what landed:

Your merge order note is noted: #232#233#234. I've flagged this to Marcus for review.

The screenshots look great — the VS Code-style diff view especially. Test plan is thorough. The minimap is a nice touch.

One heads-up: these are large diffs. Review may take a bit of time, but they're on Marcus's radar. ✦

…iles in workspace stats

- GetCommitDetail now runs --name-status alongside --numstat to get
  actual file statuses (Added, Deleted, Renamed, etc.) instead of
  defaulting everything to Modified
- Workspace getDiffStats now counts lines in untracked files as
  additions, matching what git would show if they were staged

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r diff from commit preview

- Fix h/l scrolling in full-screen diff view: clampDiffHorizScroll was
  using side-by-side parsedDiff metrics in full-file mode, clamping the
  offset back to 0 immediately. Now skips side-by-side clamp in full-file mode.
- Same fix for inline diff pane clampDiffPaneHorizScroll.
- Add l/right as aliases for enter/d in commit preview file list to enter
  the diff view, matching workspace plugin navigation conventions.
- h at offset 0 in inline diff pane now returns focus to sidebar.
- h at offset 0 in full-screen diff exits back to previous view.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants