Skip to content

Commit 36b17d8

Browse files
committed
feat(diff): improve progress indicator for apply_diff tool
Add animated dots to progress indicator based on content length Optimize when progress updates are shown (every 10 characters) Move searchBlockCount calculation inside conditional blocks Skip unnecessary ask operations when toolProgressStatus is empty
1 parent b3065d2 commit 36b17d8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/core/diff/strategies/multi-search-replace.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,13 @@ Only use a single line of '=======' between search and replacement content, beca
583583
const diffContent = toolUse.params.diff
584584
if (diffContent) {
585585
const icon = "diff-multiple"
586-
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
587586
if (toolUse.partial) {
588-
if (diffContent.length < 1000 || (diffContent.length / 50) % 10 === 0) {
587+
if (Math.floor(diffContent.length / 10) % 10 === 0) {
588+
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
589589
return { icon, text: `${searchBlockCount}` }
590590
}
591591
} else if (result) {
592+
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
592593
if (result.failParts?.length) {
593594
return {
594595
icon,

src/core/tools/applyDiffTool.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export async function applyDiffTool(
4242
toolProgressStatus = cline.diffStrategy.getProgressStatus(block)
4343
}
4444

45+
if (toolProgressStatus && Object.keys(toolProgressStatus).length === 0) {
46+
return
47+
}
48+
4549
const partialMessage = JSON.stringify(sharedMessageProps)
4650
await cline.ask("tool", partialMessage, block.partial, toolProgressStatus).catch(() => {})
4751
return

0 commit comments

Comments
 (0)