Skip to content

Commit 2f15860

Browse files
authored
Fix synchronization of scrolling event flooding (microsoft#209022)
fixes microsoft#209020
1 parent 0aca34b commit 2f15860

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/vs/workbench/contrib/scrollLocking/browser/scrollLocking.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1212
import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor';
1313
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
1414
import { IEditorPane, IEditorPaneScrollPosition, isEditorPaneWithScrolling } from 'vs/workbench/common/editor';
15+
import { ReentrancyBarrier } from 'vs/workbench/contrib/mergeEditor/browser/utils';
1516
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1617
import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar';
1718

@@ -59,6 +60,9 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
5960
this.toggleStatusbarItem(this.isActive);
6061
}
6162

63+
// makes sure that the onDidEditorPaneScroll is not called multiple times for the same event
64+
private _reentrancyBarrier = new ReentrancyBarrier();
65+
6266
private trackVisiblePanes(): void {
6367
this.paneDisposables.clear();
6468
this.paneInitialScrollTop.clear();
@@ -70,7 +74,11 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
7074
}
7175

7276
this.paneInitialScrollTop.set(pane, pane.getScrollPosition());
73-
this.paneDisposables.add(pane.onDidChangeScroll(() => this.onDidEditorPaneScroll(pane)));
77+
this.paneDisposables.add(pane.onDidChangeScroll(() =>
78+
this._reentrancyBarrier.runExclusively(() => {
79+
this.onDidEditorPaneScroll(pane);
80+
})
81+
));
7482
}
7583
}
7684

0 commit comments

Comments
 (0)