Skip to content

Commit 1d93b9d

Browse files
committed
Make staged hunks visibly framed
1 parent 2ae9550 commit 1d93b9d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/ui/src/components/panels/diff/ZedDiffViewer.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,18 @@ describe('ZedDiffViewer', () => {
139139
expect(headers[0]).toBe('a.txt');
140140
expect(headers[1]).toBe('b.txt');
141141
});
142+
143+
it('renders a persistent frame style for staged hunks', () => {
144+
const { container } = render(
145+
<ZedDiffViewer
146+
diff={SAMPLE_DIFF_TWO_HUNKS}
147+
sessionId="s1"
148+
currentScope="staged"
149+
stagedDiff={SAMPLE_DIFF_TWO_HUNKS}
150+
/>
151+
);
152+
const css = container.querySelector('style')?.textContent || '';
153+
expect(css).toContain('st-hunk-status--staged');
154+
expect(css).toContain('Zed-like: staged hunks have a persistent frame');
155+
});
142156
});

packages/ui/src/components/panels/diff/ZedDiffViewer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ export const ZedDiffViewer: React.FC<{
416416
0 0 0 3px color-mix(in srgb, var(--st-hunk-frame-color) 18%, transparent);
417417
transition: opacity 110ms ease;
418418
}
419+
/* Zed-like: staged hunks have a persistent frame to distinguish them from unstaged hunks. */
420+
.st-diff-table .diff-hunk:has(.st-hunk-status--staged):has(.diff-code-insert, .diff-code-delete)::after {
421+
opacity: 0.55;
422+
}
419423
.st-diff-table .diff-hunk:has(.diff-code-insert, .diff-code-delete):hover::after,
420424
.st-diff-table .diff-hunk:has(.diff-code-insert, .diff-code-delete):focus-within::after {
421425
opacity: 1;

0 commit comments

Comments
 (0)