MCPcopy
hub / github.com/codeaashu/claude-code / exitAlternateScreen

Method exitAlternateScreen

src/ink/ink.tsx:392–419  ·  view source on GitHub ↗

* 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),

()

Source from the content-addressed store, hash-verified

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;

Callers 4

showShellMethod · 0.80
openFileInExternalEditorFunction · 0.80
editFileInEditorFunction · 0.80
playAnimationFunction · 0.80

Calls 6

resumeStdinMethod · 0.95
repaintMethod · 0.95
resumeMethod · 0.95
supportsExtendedKeysFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected