File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -348,6 +348,9 @@ function initOptions(term: TerminalType): void {
348348 } else if ( o === 'lineHeight' || o === 'scrollSensitivity' ) {
349349 term . setOption ( o , parseFloat ( input . value ) ) ;
350350 updateTerminalSize ( ) ;
351+ } else if ( o === 'scrollback' ) {
352+ term . setOption ( o , parseInt ( input . value ) ) ;
353+ setTimeout ( ( ) => updateTerminalSize ( ) , 5 ) ;
351354 } else {
352355 term . setOption ( o , parseInt ( input . value ) ) ;
353356 }
Original file line number Diff line number Diff line change @@ -93,7 +93,12 @@ export class Viewport extends Disposable implements IViewport {
9393 this . _ignoreNextScrollEvent = true ;
9494 this . _viewportElement . scrollTop = scrollTop ;
9595 }
96-
96+ if ( this . _optionsService . getOption ( 'scrollback' ) === 0 ) {
97+ this . scrollBarWidth = 0 ;
98+ } else {
99+ this . scrollBarWidth = ( this . _viewportElement . offsetWidth - this . _scrollArea . offsetWidth ) || FALLBACK_SCROLL_BAR_WIDTH ;
100+ }
101+ this . _viewportElement . style . width = ( this . _renderService . dimensions . actualCellWidth * ( this . _bufferService . cols ) + this . scrollBarWidth ) . toString ( ) + 'px' ;
97102 this . _refreshAnimationFrame = null ;
98103 }
99104 /**
@@ -131,6 +136,9 @@ export class Viewport extends Disposable implements IViewport {
131136 this . _refresh ( immediate ) ;
132137 return ;
133138 }
139+ // This is for refreshing the viewport if scrollBarWidth has to be updated
140+ this . _refresh ( immediate ) ;
141+ return ;
134142 }
135143
136144 /**
You can’t perform that action at this time.
0 commit comments