This commit is contained in:
Benjamin Christopher Simmonds 2024-03-27 12:18:31 +01:00 committed by GitHub
parent 6363ecfa73
commit 2fbd5e0656
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,7 +97,7 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
}
if (!isEditorPaneWithScrolling(pane)) {
return;
continue;
}
const initialOffset = this.paneInitialScrollTop.get(pane);
@ -105,10 +105,17 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
throw new Error('Could not find initial offset for pane');
}
pane.setScrollPosition({
const currentPanePosition = pane.getScrollPosition();
const newPaneScrollPosition = {
scrollTop: initialOffset.scrollTop + scrolledFromInitial.scrollTop,
scrollLeft: initialOffset.scrollLeft !== undefined && scrolledFromInitial.scrollLeft !== undefined ? initialOffset.scrollLeft + scrolledFromInitial.scrollLeft : undefined,
});
};
if (currentPanePosition.scrollTop === newPaneScrollPosition.scrollTop && currentPanePosition.scrollLeft === newPaneScrollPosition.scrollLeft) {
continue;
}
pane.setScrollPosition(newPaneScrollPosition);
}
}