From dc33d4d0c045bd6631586c909508be1196801372 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Fri, 17 Jan 2025 19:09:00 -0800 Subject: [PATCH] fix offset collision with deletion --- .../contrib/void/browser/inlineDiffsService.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts index a81eefe1..093969af 100644 --- a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts +++ b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts @@ -636,8 +636,17 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { offsetLines = 0 } else if (diff.type === 'deletion') { - startLine = diff.startLine - 1 - offsetLines = 1 + // if diff.startLine is out of bounds + if (diff.startLine === 1) { + const numRedLines = diff.originalEndLine - diff.originalStartLine + 1 + startLine = diff.startLine + offsetLines = -numRedLines + } + else { + startLine = diff.startLine - 1 + offsetLines = 1 + } + } else { throw 1 }