@@ -65,6 +65,8 @@ function startServer(): void {
6565 }
6666 const cols = parseInt ( req . query . cols ) ;
6767 const rows = parseInt ( req . query . rows ) ;
68+ const pixelWidth = typeof req . query . pixelWidth === 'string' ? parseInt ( req . query . pixelWidth ) : 0 ;
69+ const pixelHeight = typeof req . query . pixelHeight === 'string' ? parseInt ( req . query . pixelHeight ) : 0 ;
6870 const isWindows = process . platform === 'win32' ;
6971 const term = pty . spawn ( isWindows ? 'powershell.exe' : 'bash' , [ ] , {
7072 name : 'xterm-256color' ,
@@ -77,7 +79,13 @@ function startServer(): void {
7779 useConptyDll : isWindows ,
7880 } ) ;
7981
80- console . log ( 'Created terminal with PID: ' + term . pid ) ;
82+ // Set pixel dimensions immediately after spawn (pty.spawn doesn't support them)
83+ if ( pixelWidth > 0 && pixelHeight > 0 ) {
84+ term . resize ( cols , rows , { width : pixelWidth , height : pixelHeight } ) ;
85+ console . log ( 'Created terminal with PID: ' + term . pid + ' (' + cols + 'x' + rows + ', ' + pixelWidth + 'px x ' + pixelHeight + 'px)' ) ;
86+ } else {
87+ console . log ( 'Created terminal with PID: ' + term . pid ) ;
88+ }
8189 terminals [ term . pid ] = term ;
8290 unsentOutput [ term . pid ] = '' ;
8391 temporaryDisposable [ term . pid ] = term . onData ( function ( data ) {
@@ -95,10 +103,17 @@ function startServer(): void {
95103 const pid = parseInt ( req . params . pid ) ;
96104 const cols = parseInt ( req . query . cols ) ;
97105 const rows = parseInt ( req . query . rows ) ;
106+ const pixelWidth = typeof req . query . pixelWidth === 'string' ? parseInt ( req . query . pixelWidth ) : 0 ;
107+ const pixelHeight = typeof req . query . pixelHeight === 'string' ? parseInt ( req . query . pixelHeight ) : 0 ;
98108 const term = terminals [ pid ] ;
99109
100- term . resize ( cols , rows ) ;
101- console . log ( 'Resized terminal ' + pid + ' to ' + cols + ' cols and ' + rows + ' rows.' ) ;
110+ if ( pixelWidth > 0 && pixelHeight > 0 ) {
111+ term . resize ( cols , rows , { width : pixelWidth , height : pixelHeight } ) ;
112+ console . log ( 'Resized terminal ' + pid + ' to ' + cols + ' cols, ' + rows + ' rows, ' + pixelWidth + 'px x ' + pixelHeight + 'px' ) ;
113+ } else {
114+ term . resize ( cols , rows ) ;
115+ console . log ( 'Resized terminal ' + pid + ' to ' + cols + ' cols and ' + rows + ' rows.' ) ;
116+ }
102117 res . end ( ) ;
103118 } ) ;
104119
0 commit comments