From 13337edcbee2071fbd2a1afd71a3b799a2e885f0 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sun, 19 Jul 2026 21:20:36 -0500 Subject: [PATCH] refactor(desktop): merge the two windowed diff returns into one --- .../src/components/chat/diff-lines.tsx | 73 +++++++++---------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/apps/desktop/src/components/chat/diff-lines.tsx b/apps/desktop/src/components/chat/diff-lines.tsx index 179e327a39d0..edcf08e38f70 100644 --- a/apps/desktop/src/components/chat/diff-lines.tsx +++ b/apps/desktop/src/components/chat/diff-lines.tsx @@ -625,50 +625,45 @@ export function FileDiffPanel({ ) } - // Windowed but no gutter (the review panel): a fixed-row scroller so only the - // visible rows render, killing the full-Shiki-of-every-line freeze on large - // diffs. The gutter variant (below) adds line numbers on top of the same window. - if (!showLineNumbers) { - return ( -
-
-
{windowedBody}
-
- -
- ) - } - - // A single line-number gutter (VS Code's inline-diff style): each row shows its - // own file's number — the new number for context/adds, the old number for - // removals — with an overview ruler pinned to the right edge. The inner div - // owns the scroll so the ruler (an absolute sibling) stays viewport-fixed. + // Windowed: a fixed-row scroller renders only the visible rows (killing the + // full-Shiki-of-every-line freeze on large diffs). With `showLineNumbers` a + // VS Code-style gutter (new number for context/adds, old for removals) sits in + // a left column; the scroller owns scroll so the overview ruler (an absolute + // sibling) stays viewport-fixed. return (
-
-
-
- {beforeRows > 0 &&
} - {visibleLineChunks.map(chunk => ( -
- {chunk.lines.map((line, offset) => { - const index = chunk.start + offset +
+ {showLineNumbers ? ( +
+
+ {beforeRows > 0 &&
} + {visibleLineChunks.map(chunk => ( +
+ {chunk.lines.map((line, offset) => { + const index = chunk.start + offset - return ( -
- {line.newNo ?? ''} -
- ) - })} -
- ))} - {afterRows > 0 &&
} + return ( +
+ {line.newNo ?? ''} +
+ ) + })} +
+ ))} + {afterRows > 0 &&
} +
+
{windowedBody}
+ ) : (
{windowedBody}
-
+ )}