@@ -1905,8 +1905,8 @@ export class CliRenderer extends EventEmitter implements RenderContext {
19051905 this . pendingSplitStartupCursorSeed && this . splitStartupSeedTimeoutId !== null
19061906 const splitTransitionSourceTopLine = this . pendingSplitFooterTransition ?. sourceTopLine ?? previousSurfaceTopLine
19071907 const splitTransitionSourceHeight = this . pendingSplitFooterTransition ?. sourceHeight ?? prevSplitHeight
1908- const splitTransitionMode = this . pendingSplitFooterTransition ?. mode ??
1909- ( splitWasSettled ? "viewport-scroll" : "clear-stale-rows" )
1908+ const splitTransitionMode =
1909+ this . pendingSplitFooterTransition ?. mode ?? ( splitWasSettled ? "viewport-scroll" : "clear-stale-rows" )
19101910
19111911 if ( this . _terminalIsSetup && leavingSplitFooter ) {
19121912 this . clearPendingSplitFooterTransition ( )
@@ -2696,14 +2696,17 @@ export class CliRenderer extends EventEmitter implements RenderContext {
26962696 this . flushPendingSplitOutputBeforeTransition ( )
26972697 }
26982698
2699+ const pendingSplitFooterTransition = this . pendingSplitFooterTransition
26992700 const previousGeometry = calculateRenderGeometry (
27002701 this . _screenMode ,
27012702 this . _terminalWidth ,
27022703 this . _terminalHeight ,
27032704 this . _footerHeight ,
27042705 )
27052706 const prevWidth = this . _terminalWidth
2706- const visiblePreviousSplitHeight = this . pendingSplitFooterTransition ?. sourceHeight ?? previousGeometry . effectiveFooterHeight
2707+ const previousTerminalHeight = this . _terminalHeight
2708+ const visiblePreviousSplitHeight =
2709+ pendingSplitFooterTransition ?. sourceHeight ?? previousGeometry . effectiveFooterHeight
27072710
27082711 this . _terminalWidth = width
27092712 this . _terminalHeight = height
@@ -2721,9 +2724,23 @@ export class CliRenderer extends EventEmitter implements RenderContext {
27212724 const splitFooterActive = this . _screenMode === "split-footer"
27222725
27232726 if ( splitFooterActive ) {
2727+ // Width shrink historically needs a broader scrub band, but if resize interrupts
2728+ // a deferred footer transition we also need to clear from that visible source surface.
2729+ let clearStart : number | null = null
2730+
27242731 if ( width < prevWidth && visiblePreviousSplitHeight > 0 ) {
2725- const start = Math . max ( this . _terminalHeight - visiblePreviousSplitHeight * 2 , 1 )
2726- const flush = ANSI . moveCursorAndClear ( start , 1 )
2732+ clearStart = Math . max ( previousTerminalHeight - visiblePreviousSplitHeight * 2 , 1 )
2733+ }
2734+
2735+ if ( pendingSplitFooterTransition !== null ) {
2736+ clearStart =
2737+ clearStart === null
2738+ ? pendingSplitFooterTransition . sourceTopLine
2739+ : Math . min ( clearStart , pendingSplitFooterTransition . sourceTopLine )
2740+ }
2741+
2742+ if ( clearStart !== null ) {
2743+ const flush = ANSI . moveCursorAndClear ( clearStart , 1 )
27272744 this . writeOut ( flush )
27282745 }
27292746
0 commit comments