File tree Expand file tree Collapse file tree
src/vs/sessions/browser/parts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ export class TitlebarPart extends Part implements ITitlebarPart {
8585 get rightContainer ( ) : HTMLElement { return this . rightContent ; }
8686 get rightWindowControlsContainer ( ) : HTMLElement | undefined { return this . windowControlsContainer ; }
8787
88+ private chatBarResizeObserver : ResizeObserver | undefined ;
89+
8890 private readonly titleBarStyle : TitlebarStyle ;
8991 private isInactive : boolean = false ;
9092
@@ -282,6 +284,26 @@ export class TitlebarPart extends Part implements ITitlebarPart {
282284 override layout ( width : number , height : number ) : void {
283285 this . updateLayout ( ) ;
284286 super . layoutContents ( width , height ) ;
287+ this . installChatBarResizeObserver ( ) ;
288+ }
289+
290+ private installChatBarResizeObserver ( ) : void {
291+ if ( this . chatBarResizeObserver ) {
292+ return ;
293+ }
294+
295+ const chatBarContainer = this . layoutService . getContainer ( getWindow ( this . element ) , Parts . CHATBAR_PART ) ;
296+ if ( ! chatBarContainer ) {
297+ return ;
298+ }
299+
300+ this . chatBarResizeObserver = new ResizeObserver ( entries => {
301+ for ( const entry of entries ) {
302+ this . centerContent . style . maxWidth = `${ entry . contentRect . width } px` ;
303+ }
304+ } ) ;
305+ this . chatBarResizeObserver . observe ( chatBarContainer ) ;
306+ this . _register ( { dispose : ( ) => this . chatBarResizeObserver ?. disconnect ( ) } ) ;
285307 }
286308
287309 private updateLayout ( ) : void {
You can’t perform that action at this time.
0 commit comments