|
4 | 4 | *--------------------------------------------------------------------------------------------*/
|
5 | 5 |
|
6 | 6 | import type { Terminal as RawXtermTerminal } from '@xterm/xterm';
|
7 |
| -import { Dimension, IFocusTracker, trackFocus } from 'vs/base/browser/dom'; |
| 7 | +import { Dimension, getActiveWindow, IFocusTracker, trackFocus } from 'vs/base/browser/dom'; |
8 | 8 | import { Event } from 'vs/base/common/event';
|
9 | 9 | import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
10 | 10 | import { MicrotaskDelay } from 'vs/base/common/symbols';
|
@@ -100,11 +100,18 @@ export class TerminalChatWidget extends Disposable {
|
100 | 100 | }
|
101 | 101 |
|
102 | 102 | private _doLayout(heightInPixel: number) {
|
103 |
| - const width = Math.min(640, this._terminalElement.clientWidth - 12/* padding */ - 2/* border */ - Constants.HorizontalMargin); |
| 103 | + const xtermElement = this._xterm.raw!.element; |
| 104 | + if (!xtermElement) { |
| 105 | + return; |
| 106 | + } |
| 107 | + const style = getActiveWindow().getComputedStyle(xtermElement); |
| 108 | + const xtermPadding = parseInt(style.paddingLeft) + parseInt(style.paddingRight); |
| 109 | + const width = Math.min(640, xtermElement.clientWidth - 12/* padding */ - 2/* border */ - Constants.HorizontalMargin - xtermPadding); |
104 | 110 | const height = Math.min(480, heightInPixel, this._getTerminalWrapperHeight() ?? Number.MAX_SAFE_INTEGER);
|
105 | 111 | if (width === 0 || height === 0) {
|
106 | 112 | return;
|
107 | 113 | }
|
| 114 | + this._container.style.paddingLeft = style.paddingLeft; |
108 | 115 | this._dimension = new Dimension(width, height);
|
109 | 116 | this._inlineChatWidget.layout(this._dimension);
|
110 | 117 |
|
|
0 commit comments