Skip to content

Commit 9e390f3

Browse files
authored
1 parent 4373424 commit 9e390f3

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/vs/editor/browser/widget/diffEditorWidget2/diffEditorDecorations.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Disposable } from 'vs/base/common/lifecycle';
77
import { IObservable, derived } from 'vs/base/common/observable';
88
import { isDefined } from 'vs/base/common/types';
9-
import { arrowRevertChange, diffAddDecoration, diffAddDecorationEmpty, diffDeleteDecoration, diffDeleteDecorationEmpty, diffLineAddDecorationBackground, diffLineAddDecorationBackgroundWithIndicator, diffLineDeleteDecorationBackground, diffLineDeleteDecorationBackgroundWithIndicator } from 'vs/editor/browser/widget/diffEditorWidget2/decorations';
9+
import { arrowRevertChange, diffAddDecoration, diffAddDecorationEmpty, diffDeleteDecoration, diffDeleteDecorationEmpty, diffLineAddDecorationBackground, diffLineAddDecorationBackgroundWithIndicator, diffLineDeleteDecorationBackground, diffLineDeleteDecorationBackgroundWithIndicator, diffWholeLineAddDecoration, diffWholeLineDeleteDecoration } from 'vs/editor/browser/widget/diffEditorWidget2/decorations';
1010
import { DiffEditorEditors } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorEditors';
1111
import { DiffEditorOptions } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorOptions';
1212
import { DiffEditorViewModel } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel';
@@ -54,19 +54,28 @@ export class DiffEditorDecorations extends Disposable {
5454
modifiedDecorations.push({ range, options: renderIndicators ? diffLineAddDecorationBackgroundWithIndicator : diffLineAddDecorationBackground });
5555
}
5656

57-
for (const i of m.lineRangeMapping.innerChanges || []) {
58-
if (currentMove
59-
&& (currentMove.lineRangeMapping.originalRange.intersect(new LineRange(i.originalRange.startLineNumber, i.originalRange.endLineNumber))
60-
|| currentMove.lineRangeMapping.modifiedRange.intersect(new LineRange(i.modifiedRange.startLineNumber, i.modifiedRange.endLineNumber)))) {
61-
continue;
57+
if (m.lineRangeMapping.modifiedRange.isEmpty || m.lineRangeMapping.originalRange.isEmpty) {
58+
for (const range of fullRangeOriginal) {
59+
originalDecorations.push({ range, options: diffWholeLineDeleteDecoration });
6260
}
63-
64-
// Don't show empty markers outside the line range
65-
if (m.lineRangeMapping.originalRange.contains(i.originalRange.startLineNumber)) {
66-
originalDecorations.push({ range: i.originalRange, options: (i.originalRange.isEmpty() && showEmptyDecorations) ? diffDeleteDecorationEmpty : diffDeleteDecoration });
61+
for (const range of fullRangeModified) {
62+
modifiedDecorations.push({ range, options: diffWholeLineAddDecoration });
6763
}
68-
if (m.lineRangeMapping.modifiedRange.contains(i.modifiedRange.startLineNumber)) {
69-
modifiedDecorations.push({ range: i.modifiedRange, options: (i.modifiedRange.isEmpty() && showEmptyDecorations) ? diffAddDecorationEmpty : diffAddDecoration });
64+
} else {
65+
for (const i of m.lineRangeMapping.innerChanges || []) {
66+
if (currentMove
67+
&& (currentMove.lineRangeMapping.originalRange.intersect(new LineRange(i.originalRange.startLineNumber, i.originalRange.endLineNumber))
68+
|| currentMove.lineRangeMapping.modifiedRange.intersect(new LineRange(i.modifiedRange.startLineNumber, i.modifiedRange.endLineNumber)))) {
69+
continue;
70+
}
71+
72+
// Don't show empty markers outside the line range
73+
if (m.lineRangeMapping.originalRange.contains(i.originalRange.startLineNumber)) {
74+
originalDecorations.push({ range: i.originalRange, options: (i.originalRange.isEmpty() && showEmptyDecorations) ? diffDeleteDecorationEmpty : diffDeleteDecoration });
75+
}
76+
if (m.lineRangeMapping.modifiedRange.contains(i.modifiedRange.startLineNumber)) {
77+
modifiedDecorations.push({ range: i.modifiedRange, options: (i.modifiedRange.isEmpty() && showEmptyDecorations) ? diffAddDecorationEmpty : diffAddDecoration });
78+
}
7079
}
7180
}
7281

0 commit comments

Comments
 (0)