Skip to content

Commit c22bb0e

Browse files
committed
When disabling collapsing unmodified code, the state should be reset.
1 parent 60b19b3 commit c22bb0e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,19 @@ export class DiffModel extends Disposable implements IDiffEditorViewModel {
3131
'unchangedRegion',
3232
{ regions: [], originalDecorationIds: [], modifiedDecorationIds: [] }
3333
);
34-
public readonly unchangedRegions: IObservable<UnchangedRegion[]> = derived('unchangedRegions', r =>
35-
this._hideUnchangedRegions.read(r) ? this._unchangedRegions.read(r).regions : []
34+
public readonly unchangedRegions: IObservable<UnchangedRegion[]> = derived('unchangedRegions', r => {
35+
if (this._hideUnchangedRegions.read(r)) {
36+
return this._unchangedRegions.read(r).regions;
37+
} else {
38+
// Reset state
39+
transaction(tx => {
40+
for (const r of this._unchangedRegions.get().regions) {
41+
r.setState(0, 0, tx);
42+
}
43+
});
44+
return [];
45+
}
46+
}
3647
);
3748

3849
public readonly syncedMovedTexts = observableValue<MovedText | undefined>('syncedMovedText', undefined);

0 commit comments

Comments
 (0)