From a728a233f2615c73d2e9f306ca5412ce3c82654d Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 17 Nov 2025 15:31:32 +0000 Subject: [PATCH] fix: restore diff count indicators after apply_diff operations - Add final tool messages with diffStats after successful single file operations - Add final tool messages with diffStats after successful batch operations - Ensures UI updates with change counters (+added -removed) after edits complete - Fixes issue where diff stats were shown during approval but disappeared after completion Fixes #9305 --- src/core/tools/MultiApplyDiffTool.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/core/tools/MultiApplyDiffTool.ts b/src/core/tools/MultiApplyDiffTool.ts index 8fd893469c..6a129d8f9c 100644 --- a/src/core/tools/MultiApplyDiffTool.ts +++ b/src/core/tools/MultiApplyDiffTool.ts @@ -664,6 +664,15 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""} // Call saveChanges to update the DiffViewProvider properties await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs) } + + // Send final tool message with diff stats to update the UI + const finalMessage = JSON.stringify({ + ...sharedMessageProps, + diff: diffContents, + content: unifiedPatch, + diffStats: computeDiffStats(unifiedPatch) || undefined, + } satisfies ClineSayTool) + await cline.ask("tool", finalMessage, false).catch(() => {}) } else { // Batch operations - already approved above if (isPreventFocusDisruptionEnabled) { @@ -687,6 +696,18 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""} // Call saveChanges to update the DiffViewProvider properties await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs) } + + // Send final tool message with diff stats for batch operations + const diffContents = diffItems.map((item) => item.content).join("\n\n") + const unifiedPatchRaw = formatResponse.createPrettyPatch(relPath, beforeContent!, originalContent!) + const unifiedPatch = sanitizeUnifiedDiff(unifiedPatchRaw) + const finalMessage = JSON.stringify({ + ...sharedMessageProps, + diff: diffContents, + content: unifiedPatch, + diffStats: computeDiffStats(unifiedPatch) || undefined, + } satisfies ClineSayTool) + await cline.ask("tool", finalMessage, false).catch(() => {}) } // Track file edit operation