mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Fix synchronization of scrolling event flooding (#209021)
fixes #209020
This commit is contained in:
parent
a1d4ad1847
commit
64c2cfccd9
|
@ -12,6 +12,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||||
import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor';
|
import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor';
|
||||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||||
import { IEditorPane, IEditorPaneScrollPosition, isEditorPaneWithScrolling } from 'vs/workbench/common/editor';
|
import { IEditorPane, IEditorPaneScrollPosition, isEditorPaneWithScrolling } from 'vs/workbench/common/editor';
|
||||||
|
import { ReentrancyBarrier } from 'vs/workbench/contrib/mergeEditor/browser/utils';
|
||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar';
|
import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar';
|
||||||
|
|
||||||
|
@ -59,6 +60,9 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
|
||||||
this.toggleStatusbarItem(this.isActive);
|
this.toggleStatusbarItem(this.isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// makes sure that the onDidEditorPaneScroll is not called multiple times for the same event
|
||||||
|
private _reentrancyBarrier = new ReentrancyBarrier();
|
||||||
|
|
||||||
private trackVisiblePanes(): void {
|
private trackVisiblePanes(): void {
|
||||||
this.paneDisposables.clear();
|
this.paneDisposables.clear();
|
||||||
this.paneInitialScrollTop.clear();
|
this.paneInitialScrollTop.clear();
|
||||||
|
@ -70,7 +74,11 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.paneInitialScrollTop.set(pane, pane.getScrollPosition());
|
this.paneInitialScrollTop.set(pane, pane.getScrollPosition());
|
||||||
this.paneDisposables.add(pane.onDidChangeScroll(() => this.onDidEditorPaneScroll(pane)));
|
this.paneDisposables.add(pane.onDidChangeScroll(() =>
|
||||||
|
this._reentrancyBarrier.runExclusively(() => {
|
||||||
|
this.onDidEditorPaneScroll(pane);
|
||||||
|
})
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue