Skip to content

Commit 4a1327e

Browse files
committed
Have terminal chat align with xterm element
We didn't do this originally in order to hide the shell integration decoration, but since that is not longer typical we can padd things out to align closer with the editor
1 parent 3211128 commit 4a1327e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
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';
88
import { Event } from 'vs/base/common/event';
99
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
1010
import { MicrotaskDelay } from 'vs/base/common/symbols';
@@ -100,11 +100,18 @@ export class TerminalChatWidget extends Disposable {
100100
}
101101

102102
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);
104110
const height = Math.min(480, heightInPixel, this._getTerminalWrapperHeight() ?? Number.MAX_SAFE_INTEGER);
105111
if (width === 0 || height === 0) {
106112
return;
107113
}
114+
this._container.style.paddingLeft = style.paddingLeft;
108115
this._dimension = new Dimension(width, height);
109116
this._inlineChatWidget.layout(this._dimension);
110117

0 commit comments

Comments
 (0)