[UI] Cover the stack diff preview pane with tests - #37
Merged
Conversation
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
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exercises the split preview added in the previous commit, plus the two git
helpers behind it.
internal/tui:
dtoggles 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):