mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fix StableEditorBottomScrollState (#212970)
This commit is contained in:
parent
2b277fcb56
commit
ba6fb3b36e
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { ScrollType } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export class StableEditorScrollState {
|
||||
|
||||
|
@ -59,7 +60,7 @@ export class StableEditorScrollState {
|
|||
}
|
||||
|
||||
const offset = editor.getTopForLineNumber(currentCursorPosition.lineNumber) - editor.getTopForLineNumber(this._cursorPosition.lineNumber);
|
||||
editor.setScrollTop(editor.getScrollTop() + offset);
|
||||
editor.setScrollTop(editor.getScrollTop() + offset, ScrollType.Immediate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,7 @@ export class StableEditorBottomScrollState {
|
|||
if (visibleRanges.length > 0) {
|
||||
visiblePosition = visibleRanges.at(-1)!.getEndPosition();
|
||||
const visiblePositionScrollBottom = editor.getBottomForLineNumber(visiblePosition.lineNumber);
|
||||
visiblePositionScrollDelta = (editor.getScrollTop() + editor.getLayoutInfo().height) - visiblePositionScrollBottom;
|
||||
visiblePositionScrollDelta = visiblePositionScrollBottom - editor.getScrollTop();
|
||||
}
|
||||
return new StableEditorBottomScrollState(editor.getScrollTop(), editor.getContentHeight(), visiblePosition, visiblePositionScrollDelta);
|
||||
}
|
||||
|
@ -99,7 +100,7 @@ export class StableEditorBottomScrollState {
|
|||
|
||||
if (this._visiblePosition) {
|
||||
const visiblePositionScrollBottom = editor.getBottomForLineNumber(this._visiblePosition.lineNumber);
|
||||
editor.setScrollTop(visiblePositionScrollBottom - (this._visiblePositionScrollDelta + editor.getLayoutInfo().height));
|
||||
editor.setScrollTop(visiblePositionScrollBottom - this._visiblePositionScrollDelta, ScrollType.Immediate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue