* Clear the physical terminal and force a full redraw. * * The traditional readline ctrl+l — redraws the current content from home. * Also the recovery path when the terminal was cleared externally * (macOS Cmd+K) and Ink's diff engine thinks unchanged cells don't need * repainting. S
(options?: { clearBeforePaint?: boolean; forceHomeRepaint?: boolean })
| 946 | * repainting. Scrollback is preserved. |
| 947 | */ |
| 948 | forceRedraw(options?: { clearBeforePaint?: boolean; forceHomeRepaint?: boolean }): void { |
| 949 | if (!this.options.stdout.isTTY || this.isUnmounted || this.isPaused) return; |
| 950 | if (this.altScreenActive) { |
| 951 | // Alt-screen force redraw should not toggle mode 1049. Keep recovery |
| 952 | // in-band with the next frame so terminals that treat ?1049h as a |
| 953 | // clear while already in alt do not flash blank. |
| 954 | const recoveryMode = getAltScreenRecoveryRepaintMode( |
| 955 | SYNC_OUTPUT_SUPPORTED, |
| 956 | ); |
| 957 | this.resetFramesForAltScreen(); |
| 958 | this.altScreenPendingRepaintMode = recoveryMode; |
| 959 | if (this.altScreenMouseTracking) { |
| 960 | this.options.stdout.write(ENABLE_MOUSE_TRACKING); |
| 961 | } |
| 962 | } else { |
| 963 | // Main-screen force redraw should follow the same in-band repair path |
| 964 | // as other recovery flows. Clearing first flashes blank on common |
| 965 | // terminals even though the next frame can already repaint the |
| 966 | // viewport from home. |
| 967 | this.displayCursor = null; |
| 968 | this.mainScreenPendingRepaintFromHome = true; |
| 969 | this.mainScreenPendingClearBeforePaint = !!options?.clearBeforePaint; |
| 970 | if (options?.forceHomeRepaint) { |
| 971 | this.mainScreenPendingForceHomeRepaint = true; |
| 972 | } |
| 973 | } |
| 974 | this.onRender(); |
| 975 | } |
| 976 | |
| 977 | /** |
| 978 | * Mark the previous frame as untrustworthy for blit, forcing the next |
no test coverage detected