fix(webui): preserve file edit stats and left-truncate long paths (#6388)

* fix(webui): preserve file edit stats and truncate paths from start (NAN-332)

* fix(webui): remove redundant collapsed diff line totals

* fix(webui): include full paths in image edit hints
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-22 14:34:36 +08:00
1 parent b45048d415
commit f9257c3548
16 files changed
+160 -46

No files matched your search

@@ -108,17 +108,21 @@ function FileEditRow({
? t("message.fileEditPreparing", { defaultValue: "Preparing file edit…" })
: (
<span className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap">
<FileReferenceChip
path={edit.path}
previewPath={edit.absolute_path || edit.path}
onOpen={onOpenFilePreview}
display="path"
showIcon={false}
active={editing}
className="min-w-0"
textClassName="truncate text-[12px]"
testId="activity-file-reference"
/>
<span className="flex min-w-0 shrink overflow-hidden">
<FileReferenceChip
path={edit.path}
tooltipPath={edit.absolute_path || edit.path}
previewPath={edit.absolute_path || edit.path}
onOpen={onOpenFilePreview}
display="path"
showIcon={false}
active={editing}
className="min-w-0"
truncateFromStart
textClassName="text-[12px]"
testId="activity-file-reference"
/>
</span>
{hasCountedDiff ? <DiffPair added={edit.added} deleted={edit.deleted} /> : null}
</span>
)}
@@ -194,10 +198,6 @@ function FileUnifiedDiff({
: EMPTY_VISIBLE_DIFF,
[lineLimit, renderableDiff, shouldRenderBody, totalLineCount],
);
const lineCountLabel = t("message.fileEditDiffLineCount", {
count: diff.truncated ? `${totalLineCount}+` : totalLineCount,
defaultValue: "{{count}} lines",
});
const viewDiffLabel = shouldAutoCollapse
? tx("message.fileEditViewLargeDiff", "View large diff")
: tx("message.fileEditViewDiff", "View diff");
@@ -319,7 +319,6 @@ function FileUnifiedDiff({
aria-hidden
/>
<span className="min-w-0 flex-1">{viewDiffLabel}</span>
<span className="shrink-0 text-muted-foreground">{lineCountLabel}</span>
</button>
<DisclosureContent id={contentId} open={open} onExitComplete={releaseBody}>
{shouldRenderBody ? renderBody() : null}