inline chat fixes (#233566)

* take decorationWidth into account when layouting chat zone

https://github.com/microsoft/vscode/issues/233561

* chat - fix input height computation when resizing editor
This commit is contained in:
Johannes Rieken
2024-11-11 11:42:18 +01:00
committed by GitHub
parent c6b0284ee9
commit f9a75f1418
4 changed files with 24 additions and 5 deletions

View File

@@ -151,8 +151,10 @@ export class InlineChatZoneWidget extends ZoneWidget {
protected override _doLayout(heightInPixel: number): void {
this._updatePadding();
const info = this.editor.getLayoutInfo();
let width = info.contentWidth + info.glyphMarginWidth - 8;
let width = info.contentWidth - info.verticalScrollbarWidth;
width = Math.min(850, width);
this._dimension = new Dimension(width, heightInPixel);
@@ -190,9 +192,7 @@ export class InlineChatZoneWidget extends ZoneWidget {
override show(position: Position): void {
assertType(this.container);
const info = this.editor.getLayoutInfo();
const marginWithoutIndentation = info.glyphMarginWidth + info.lineNumbersWidth;
this.container.style.paddingLeft = `${marginWithoutIndentation}px`;
this._updatePadding();
const revealZone = this._createZoneAndScrollRestoreFn(position);
super.show(position, this._computeHeight().linesValue);
@@ -203,6 +203,14 @@ export class InlineChatZoneWidget extends ZoneWidget {
this._scrollUp.enable();
}
private _updatePadding() {
assertType(this.container);
const info = this.editor.getLayoutInfo();
const marginWithoutIndentation = info.glyphMarginWidth + info.lineNumbersWidth + info.decorationsWidth;
this.container.style.paddingLeft = `${marginWithoutIndentation}px`;
}
reveal(position: Position) {
const stickyScroll = this.editor.getOption(EditorOption.stickyScroll);
const magicValue = stickyScroll.enabled ? stickyScroll.maxLineCount : 0;