diff --git a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts index 82fb5ee8..0422f5df 100644 --- a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts +++ b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts @@ -635,13 +635,17 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { // restore file content const numLines = this._getNumLines(uri) if (numLines === null) return - this._writeText(uri, entireModelCode, - { startColumn: 1, startLineNumber: 1, endLineNumber: numLines, endColumn: Number.MAX_SAFE_INTEGER }, - { shouldRealignDiffAreas: false } - ) - // restore all the decorations - // this._refreshStylesAndDiffsInURI(uri) + const hasWriteChange = this._readURI(uri) !== entireModelCode // a heuristic check + if (hasWriteChange) + this._writeText(uri, entireModelCode, + { startColumn: 1, startLineNumber: 1, endLineNumber: numLines, endColumn: Number.MAX_SAFE_INTEGER }, + { shouldRealignDiffAreas: false } + ) + else { + // restore all the decorations + this._refreshStylesAndDiffsInURI(uri) + } } const beforeSnapshot: HistorySnapshot = getCurrentSnapshot()