Skip to content

diff: expand collapsed context on demand - #133

Open
hewigovens wants to merge 1 commit into
mainfrom
h/issue-132-expand-context
Open

diff: expand collapsed context on demand#133
hewigovens wants to merge 1 commit into
mainfrom
h/issue-132-expand-context

Conversation

@hewigovens

Copy link
Copy Markdown
Owner

Collapsed "N unmodified lines" separators in the diff views are now interactive: Show 10 reveals the next chunk above the change and Show all expands the whole region — in both the unified and side-by-side views, in both shells.

Closes #132.

How it works

  • jj-diff gains an ExpandableDiff that splices revealed context into the collapsed diff in place instead of rebuilding it, keeps region identity stable across repeated expansions, and re-highlights only the visible lines through the shared VisibleHighlightSource. Stale or invalid region requests surface as typed errors through UniFFI rather than panics.
  • Side-by-side rows now carry their context_region directly from core, so both shells read it off the row — the previous positional re-derivation in each shell is gone.
  • SwiftUI anchors the viewport so the clicked separator stays put while text above it expands; the NSTextView updates in place. GPUI invalidates its wrap cache per expansion and preserves scroll position.
  • Expansion state is pinned to the commit and whitespace mode with supersession guards, so amends and mode toggles reset it instead of installing stale rows.

Testing

Core expand/collapse/performance tests, GPUI component tests (repo_diff_context, wrap-cache), JayJayDiffUI and JayJayTests unit coverage, and a new ContextExpansionScene UI test backed by a dedicated single-region fixture.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dacda7b496

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/mac/Sources/JayJay/Diff/DiffSection.swift Outdated
Comment thread crates/jj-diff/src/expand.rs Outdated
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch from dacda7b to 59ef5f3 Compare August 3, 2026 03:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59ef5f3fe0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/jj-diff/src/expand.rs Outdated
Comment thread crates/jj-diff/src/expand.rs Outdated
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch from 59ef5f3 to b5c81d8 Compare August 3, 2026 03:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5c81d8fde

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/jj-diff/src/expand.rs Outdated
Comment thread shell/gpui/src/diff/diff_view/context_controls.rs
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch from b5c81d8 to ea225ee Compare August 3, 2026 04:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea225eeb84

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/gpui/src/repo/window/context_expansion.rs
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch from ea225ee to f64a486 Compare August 3, 2026 04:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f64a486eb2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/jj-diff/src/tests/expand.rs Outdated
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch from f64a486 to e404701 Compare August 3, 2026 04:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e40470129b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/gpui/src/repo/window/context_expansion.rs Outdated
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch 5 times, most recently from 4de82cc to c58e5c3 Compare August 3, 2026 14:17
Collapsed "N unmodified lines" separators in the diff views are now interactive: Show 10 reveals the next chunk above the change and Show all expands the whole region, in both the unified and side-by-side views and in both shells. The core gains an ExpandableDiff that splices revealed context into the collapsed diff without rebuilding it, keeps region identity stable across repeated expansions, and re-highlights only visible lines. Side-by-side rows carry their context region directly so both shells read it off the row instead of re-deriving it positionally. Covered by core expand/collapse tests, GPUI component tests, JayJayDiffUI unit tests, and a new ContextExpansionScene UI test backed by a dedicated single-region fixture.
@hewigovens
hewigovens force-pushed the h/issue-132-expand-context branch from c58e5c3 to ae81fbe Compare August 3, 2026 14:18
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.

Feature request: ability to expand "xxx unmodified lines"

1 participant