* Resume Ink after an external TUI handoff with a full repaint. * In non-fullscreen mode this exits the alt screen back to main; * in fullscreen mode we re-enter alt and clear + repaint. * * The re-enter matters: terminal editors (vim, nano, less) write * smcup/rmcup (?1049h/?1049l),
()
| 390 | * returns, fullscreen scroll is dead. |
| 391 | */ |
| 392 | exitAlternateScreen(): void { |
| 393 | this.options.stdout.write((this.altScreenActive ? ENTER_ALT_SCREEN : '') + |
| 394 | // re-enter alt — vim's rmcup dropped us to main |
| 395 | '\x1b[2J' + |
| 396 | // clear screen (now alt if fullscreen) |
| 397 | '\x1b[H' + ( |
| 398 | // cursor home |
| 399 | this.altScreenMouseTracking ? ENABLE_MOUSE_TRACKING : '') + ( |
| 400 | // re-enable mouse (skip if CLAUDE_CODE_DISABLE_MOUSE) |
| 401 | this.altScreenActive ? '' : '\x1b[?1049l') + |
| 402 | // exit alt (non-fullscreen only) |
| 403 | '\x1b[?25l' // hide cursor (Ink manages) |
| 404 | ); |
| 405 | this.resumeStdin(); |
| 406 | if (this.altScreenActive) { |
| 407 | this.resetFramesForAltScreen(); |
| 408 | } else { |
| 409 | this.repaint(); |
| 410 | } |
| 411 | this.resume(); |
| 412 | // Re-enable focus reporting and extended key reporting — terminal |
| 413 | // editors (vim, nano, etc.) write their own modifyOtherKeys level on |
| 414 | // entry and reset it on exit, leaving us unable to distinguish |
| 415 | // ctrl+shift+<letter> from ctrl+<letter>. Pop-before-push keeps the |
| 416 | // Kitty stack balanced (a well-behaved editor restores our entry, so |
| 417 | // without the pop we'd accumulate depth on each editor round-trip). |
| 418 | this.options.stdout.write('\x1b[?1004h' + (supportsExtendedKeys() ? DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS : '')); |
| 419 | } |
| 420 | onRender() { |
| 421 | if (this.isUnmounted || this.isPaused) { |
| 422 | return; |
no test coverage detected