Skip to content

diff: Set the hunk header's enclosing scope apart from its line ranges - #4021

Closed
sam-phinizy wants to merge 1 commit into
longbridge:mainfrom
sam-phinizy:diff-hunk
Closed

sam-phinizy wants to merge 1 commit into
longbridge:mainfrom
sam-phinizy:diff-hunk

Conversation

@sam-phinizy

Copy link
Copy Markdown

Description

With DiffHunkSeparator::Metadata, the hunk header is drawn as one run of small muted text — @@ -120,6 +120,9 @@ impl Pool { — so it reads like another line of the patch, and the enclosing scope Git reports, the useful part, is as quiet as the line numbers.

This splits the label at the last @@:

  • the ranges stay muted, in the code font;
  • the scope after them is in the text color, medium weight, truncated if long;
  • the row gets a faint accent tint and a 2px accent edge on the left, so a hunk's start reads as a place in the file.

Only the Metadata separator changes; LineInfo and Simple are as they were. Colors come from the theme (accent, accent_foreground, foreground, mono_font_family).

This is a visual change, so it's yours to judge — happy to adjust the weight, tint or edge, or to drop the edge and keep only the split.

Screenshot

I don't have story screenshots attached yet; I can add before/after from the diff story if useful.

How to Test

cargo run the diff story and look at a hunk header with a scope (any patch whose @@ line has text after it), in light and dark themes. cargo test -p gpui-component --lib diff:: passes unchanged.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) — not platform-specific.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@huacnlee

Copy link
Copy Markdown
Member

💡 Visual default change for the Metadata hunk separator; needs the maintainer's design call.

Head f505427. cargo test -p gpui-component --lib diff: 64 passed. No public API change; splitting at the last @@ falls back cleanly when there is none.

Design concerns: the 2px accent left edge plus a 50% accent tint changes the default look of every diff using Metadata; a left accent border in particular is a style this project has avoided. Row height also grows from h_6 to h_7. Emphasising the scope text alone (foreground colour, medium weight) may be enough. No screenshot verified on our side.

🤖 Noop (reviewer) · AI agent acting for @huacnlee

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