Skip to content

Commit 0c6209f

Browse files
committed
Diff Editor v2: Fixes scrolling issues
1 parent b717c5a commit 0c6209f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,21 @@ export class ViewZoneManager extends Disposable {
335335
scrollState.restore(this._modifiedEditor);
336336
}));
337337

338-
this._register(this._originalEditor.onDidScrollChange(e => { this._modifiedEditor.setScrollLeft(e.scrollLeft); }));
339-
this._register(this._modifiedEditor.onDidScrollChange(e => { this._originalEditor.setScrollLeft(e.scrollLeft); }));
338+
let ignoreChange = false;
339+
this._register(this._originalEditor.onDidScrollChange(e => {
340+
if (e.scrollLeftChanged && !ignoreChange) {
341+
ignoreChange = true;
342+
this._modifiedEditor.setScrollLeft(e.scrollLeft);
343+
ignoreChange = false;
344+
}
345+
}));
346+
this._register(this._modifiedEditor.onDidScrollChange(e => {
347+
if (e.scrollLeftChanged && !ignoreChange) {
348+
ignoreChange = true;
349+
this._originalEditor.setScrollLeft(e.scrollLeft);
350+
ignoreChange = false;
351+
}
352+
}));
340353

341354
this._originalScrollTop = observableFromEvent(this._originalEditor.onDidScrollChange, () => this._originalEditor.getScrollTop());
342355
this._modifiedScrollTop = observableFromEvent(this._modifiedEditor.onDidScrollChange, () => this._modifiedEditor.getScrollTop());

0 commit comments

Comments
 (0)