From 75139a12260751e1721ab46943df2415d4d0174f Mon Sep 17 00:00:00 2001 From: xintaofei Date: Sat, 28 Mar 2026 16:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=B7=A5=E5=85=B7=E9=87=8C=E5=A4=9Ahunk=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/diff/unified-diff-preview.tsx | 25 ++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/diff/unified-diff-preview.tsx b/src/components/diff/unified-diff-preview.tsx index 9749e74..f25113e 100644 --- a/src/components/diff/unified-diff-preview.tsx +++ b/src/components/diff/unified-diff-preview.tsx @@ -446,9 +446,21 @@ function rowMarker(row: ParsedDiffRow): RowMarker { return "none" } +function HunkSeparator({ hunk }: { hunk: ParsedDiffHunk }) { + const label = + hunk.oldStart != null && hunk.oldCount != null + ? `@@ -${hunk.oldStart},${hunk.oldCount} +${hunk.newStart ?? hunk.oldStart},${hunk.newCount ?? hunk.oldCount} @@` + : "ยทยทยท" + return ( +
+ {label} +
+ ) +} + function HunkLines({ rows }: { rows: ParsedDiffRow[] }) { return ( -
+
{rows.map((row, i) => { const marker = rowMarker(row) return ( @@ -540,9 +552,14 @@ export function UnifiedDiffPreview({
- {file.hunks.map((hunk) => ( - - ))} +
+ {file.hunks.map((hunk, hunkIdx) => ( +
+ {hunkIdx > 0 && } + +
+ ))} +
))}