@@ -459,6 +459,8 @@ const CONTAINER_HEIGHT_PADDING = 6;
459459export class ContentHoverWidget extends ResizableContentWidget {
460460
461461 public static ID = 'editor.contrib.resizableContentHoverWidget' ;
462+ private static _lastHeight : number = 0 ;
463+ private static _lastWidth : number = 0 ;
462464
463465 private _visibleData : ContentHoverVisibleData | undefined ;
464466 private _positionPreference : ContentWidgetPositionPreference | undefined ;
@@ -582,6 +584,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
582584 }
583585
584586 protected override _resize ( size : dom . Dimension ) : void {
587+ ContentHoverWidget . _lastHeight = size . height ;
588+ ContentHoverWidget . _lastWidth = size . width ;
585589 this . _setAdjustedHoverWidgetDimensions ( size ) ;
586590 this . _resizableNode . layout ( size . height , size . width ) ;
587591 this . _setResizableNodeMaxDimensions ( ) ;
@@ -654,12 +658,13 @@ export class ContentHoverWidget extends ResizableContentWidget {
654658 }
655659
656660 private _layout ( ) : void {
657- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
661+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastHeight ) ;
662+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastWidth ) ;
658663 const { fontSize, lineHeight } = this . _editor . getOption ( EditorOption . fontInfo ) ;
659664 const contentsDomNode = this . _hover . contentsDomNode ;
660665 contentsDomNode . style . fontSize = `${ fontSize } px` ;
661666 contentsDomNode . style . lineHeight = `${ lineHeight / fontSize } ` ;
662- this . _setContentsDomNodeMaxDimensions ( Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) , height ) ;
667+ this . _setContentsDomNodeMaxDimensions ( width , height ) ;
663668 }
664669
665670 private _updateFont ( ) : void {
@@ -680,8 +685,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
680685 }
681686
682687 private _updateContentsDomNodeMaxDimensions ( ) {
683- const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) ;
684- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
688+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastWidth ) ;
689+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastHeight ) ;
685690 this . _setContentsDomNodeMaxDimensions ( width , height ) ;
686691 }
687692
0 commit comments