Skip to content

[UI] Cover the stack diff preview pane with tests - #37

Merged
KCaverly merged 2 commits into
mainfrom
ct/diff_view/ed660879
Jul 26, 2026
Merged

[UI] Cover the stack diff preview pane with tests#37
KCaverly merged 2 commits into
mainfrom
ct/diff_view/ed660879

Conversation

@KCaverly

@KCaverly KCaverly commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Exercises the split preview added in the previous commit, plus the two git
helpers behind it.

internal/tui: d toggles the pane on and back off with the overlay intact;
tab flips focus and swaps the footer; j (list focus) and n/p (diff focus)
walk commits and fetch only on a cache miss, with n/p staying in the diff
pane; esc steps out of the split before closing; an arriving patch populates
the cache and renders, while one keyed to another worktree is dropped; the
scroll and file-jump keys are inert without a cached patch rather than
panicking; a refresh drops cached patches. Regression guards keep enter
inert on a row and leave v routed to the whole-branch diff, and a
fixed-geometry assertion pins the two-column layout.

internal/repo: DiffCommit/NumstatCommit over a throwaway repo, covering both
the ordinary sha^..sha case and the root-commit fallback. These live in
integration_test.go with the other git-backed tests, keeping repo_test.go
free of a git dependency.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com


Stack (bottom → top):

  1. [UI] Add a per-commit diff preview pane to the stack screen #36
  2. [UI] Cover the stack diff preview pane with tests #37 ← this PR
  3. [Git] Stop inlining binary literals in the per-commit diff #38
  4. [UI] Re-prime the stack preview when the status behind it changes #39
  5. [Git] Stop returning quoted, octal-escaped untracked paths #40
  6. [Git] Add DiffUntracked to render untracked file contents #41
  7. [UI] Show uncommitted work as a row in the stack #42
  8. [UI] Name one way out of the stack preview #43
  9. [UI] Give d the preview and esc the way out #44
  10. [UI] Drop the branch-diff jump from the stack screen #45
  11. [UI] Stop the stack preview overrunning a narrow terminal #46
  12. [Git] Pin the diff flags the body parser depends on #47
  13. [UI] Teach both diff viewers the same file-jump key #48
  14. [Diff] Thread the [diff] config through the viewer and zoom with z #49
  15. [Git] Carry diff args and excludes through every diff call #50
  16. [Diff] Add the external diff pager package #51
  17. [Config] Accept a [diff] section with an optional pager #52
  18. [Docs] Document the diff viewer settings #53

KCaverly and others added 2 commits July 26, 2026 15:04
The stack screen already cursors over one commit per row, but its only
drill-in was `v`, which left the overlay for the deck's whole-branch diff.
`d` now toggles a split preview: the commit list collapses to a narrow left
column and the cursored commit's patch fills the rest of the width, so the
stack and its diffs read as one surface.

- `d` toggles the preview on and off; `enter` keeps its existing meaning
  (inert on a row, confirms a pending restack), and `v` still opens the
  whole-branch diff.
- `tab` moves focus between the panes. With the list focused, j/k move the
  commit cursor and the pane follows; with the diff focused, j/k and the
  wheel scroll, ]/[ jump files, and n/p walk to the adjacent commit without
  leaving the pane.
- `esc` steps out of the split first, then closes the overlay.
- Patches are fetched off the UI goroutine, keyed by worktree and SHA so
  stale fetches drop, and cached per commit (dropped on a status refresh)
  so walking the stack is instant.

repo gains DiffCommit/NumstatCommit (sha^..sha, with a root-commit fallback
to the empty tree); the pane reuses the existing diff builder and styling.

Tests for the new split routing and repo helpers are still outstanding.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ct-stack-id: 56adb217
Exercises the split preview added in the previous commit, plus the two git
helpers behind it.

internal/tui: `d` toggles the pane on and back off with the overlay intact;
tab flips focus and swaps the footer; j (list focus) and n/p (diff focus)
walk commits and fetch only on a cache miss, with n/p staying in the diff
pane; esc steps out of the split before closing; an arriving patch populates
the cache and renders, while one keyed to another worktree is dropped; the
scroll and file-jump keys are inert without a cached patch rather than
panicking; a refresh drops cached patches. Regression guards keep enter
inert on a row and leave v routed to the whole-branch diff, and a
fixed-geometry assertion pins the two-column layout.

internal/repo: DiffCommit/NumstatCommit over a throwaway repo, covering both
the ordinary sha^..sha case and the root-commit fallback. These live in
integration_test.go with the other git-backed tests, keeping repo_test.go
free of a git dependency.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ct-stack-id: ed660879
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