mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
inline chat stable scroll should ensure first line stays visible (#216705)
This commit is contained in:
parent
4795e48fb5
commit
07dcb7aff4
|
@ -184,12 +184,21 @@ export class InlineChatZoneWidget extends ZoneWidget {
|
|||
|
||||
const lineTop = this.editor.getTopForLineNumber(lineNumber);
|
||||
const zoneTop = lineTop - height.pixelsValue;
|
||||
// const spaceBelowLine = this.editor.getScrollHeight() - this.editor.getBottomForLineNumber(position.lineNumber);
|
||||
// const minTop = this.editor.getScrollTop() - spaceBelowLine;
|
||||
// const newTop = Math.max(zoneTop, minTop);
|
||||
const newTop = zoneTop;
|
||||
|
||||
const editorHeight = this.editor.getLayoutInfo().height;
|
||||
const newLineBottom = this.editor.getBottomForLineNumber(lineNumber);
|
||||
|
||||
let newTop: number;
|
||||
if (newLineBottom > editorHeight) {
|
||||
newTop = newLineBottom - editorHeight;
|
||||
} else {
|
||||
newTop = zoneTop;
|
||||
}
|
||||
|
||||
const currentTop = this.editor.getScrollTop();
|
||||
|
||||
// console.log('REVEAL ZONE TOP', { zoneTop, newLineBottom, editorHeight, currentTop, newTop });
|
||||
|
||||
if (newTop < currentTop) {
|
||||
this.editor.setScrollTop(newTop, ScrollType.Immediate);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue