Skip to content

feat: split terminal panel with Ctrl+T toggle#233

Open
yashas-salankimatt wants to merge 18 commits intomarcus:mainfrom
yashas-salankimatt:terminal-panel
Open

feat: split terminal panel with Ctrl+T toggle#233
yashas-salankimatt wants to merge 18 commits intomarcus:mainfrom
yashas-salankimatt:terminal-panel

Conversation

@yashas-salankimatt
Copy link
Contributor

Summary

  • Add a split terminal panel (Ctrl+T) that opens a secondary tmux pane alongside the agent output
  • Supports bottom and right layouts, switchable with Alt+T
  • Panel size is adjustable via mouse drag and persisted across restarts
  • Interactive mode works in both agent and terminal panel panes

Key Changes

  • New terminal_panel.go with full tmux session management, rendering, and resize logic
  • Ctrl+T toggles terminal panel visibility with auto-focus
  • Alt+T switches between bottom/right layout while panel is visible
  • Mouse drag to resize the panel divider
  • State persistence via config for layout preference and panel size
  • Keyboard bindings added to keymap for both workspace-list and workspace-preview contexts

Test plan

  • Press Ctrl+T to open terminal panel, verify it appears with a shell
  • Press Ctrl+T again to hide it
  • Press Ctrl+T to reopen, verify same layout as before
  • Press Alt+T to switch between bottom and right layouts
  • Drag the divider to resize, restart sidecar, verify size persisted
  • Click agent output area while in terminal panel interactive mode — verify focus switches
  • Click terminal panel while in agent interactive mode — verify focus switches
  • Type commands in terminal panel, verify they execute correctly
  • Verify Ctrl+T works from within interactive mode (not forwarded to tmux)

🤖 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

Screenshots:

Screenshot 2026-03-13 at 7 15 06 AM Screenshot 2026-03-13 at 7 15 21 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>
…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>
@yashas-salankimatt yashas-salankimatt force-pushed the terminal-panel branch 3 times, most recently from 62e56bf to 02c26b2 Compare March 14, 2026 09:31
yashas-salankimatt and others added 3 commits March 14, 2026 02:49
…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>
Adds a persistent terminal panel that splits the workspace preview pane,
allowing side-by-side agent/shell output and an independent terminal.

- Ctrl+T toggles panel visibility, Alt+T switches bottom/right layout
- Adaptive polling mirrors agent pane performance (active/idle/unfocus intervals)
- Interactive mode with seamless click-to-switch between panes
- Mouse drag to resize the split, state persisted across sessions
- Session restoration on restart via worktree-aware tmux sessions

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

1 participant