@@ -16,11 +16,7 @@ export class DecorationService extends Disposable implements IDecorationService
1616 private _screenElement : HTMLElement | undefined ;
1717 private _renderService : IRenderService | undefined ;
1818
19- constructor (
20- @IInstantiationService private readonly _instantiationService : IInstantiationService ,
21- @IBufferService private readonly _bufferService : IBufferService ) {
22- super ( ) ;
23- }
19+ constructor ( @IInstantiationService private readonly _instantiationService : IInstantiationService ) { super ( ) ; }
2420
2521 public attachToDom ( screenElement : HTMLElement , renderService : IRenderService ) : void {
2622 this . _renderService = renderService ;
@@ -120,7 +116,8 @@ export class Decoration extends Disposable implements IDecoration {
120116 this . _element . style . top = `${ ( this . marker . line - this . _bufferService . buffers . active . ydisp ) * renderService . dimensions . scaledCellHeight } px` ;
121117
122118 if ( this . x && this . x > this . _bufferService . cols ) {
123- this . _element ! . style . display = 'none' ;
119+ // exceeded the container width, so hide
120+ this . _element . style . display = 'none' ;
124121 }
125122 if ( this . anchor === 'right' ) {
126123 this . _element . style . right = this . x ? `${ this . x * renderService . dimensions . scaledCellWidth } px` : '' ;
@@ -147,13 +144,16 @@ export class Decoration extends Disposable implements IDecoration {
147144 }
148145
149146 private _refreshStyle ( renderService : IRenderService ) : void {
147+ if ( ! this . _element ) {
148+ return ;
149+ }
150150 const line = this . marker . line - this . _bufferService . buffers . active . ydisp ;
151151 if ( line < 0 || line > this . _bufferService . rows ) {
152152 // outside of viewport
153- this . _element ! . style . display = 'none' ;
153+ this . _element . style . display = 'none' ;
154154 } else {
155- this . _element ! . style . top = `${ line * renderService . dimensions . scaledCellHeight } px` ;
156- this . _element ! . style . display = this . _altBufferActive ? 'none' : 'block' ;
155+ this . _element . style . top = `${ line * renderService . dimensions . scaledCellHeight } px` ;
156+ this . _element . style . display = this . _altBufferActive ? 'none' : 'block' ;
157157 }
158158 }
159159}
0 commit comments