mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
Switch to alternate buffer mode before rendering Ink. (#12833)
This commit is contained in:
@@ -73,6 +73,7 @@ import { createPolicyUpdater } from './config/policy.js';
|
||||
import { requestConsentNonInteractive } from './config/extensions/consent.js';
|
||||
import { disableMouseEvents, enableMouseEvents } from './ui/utils/mouse.js';
|
||||
import { ScrollProvider } from './ui/contexts/ScrollProvider.js';
|
||||
import ansiEscapes from 'ansi-escapes';
|
||||
|
||||
const SLOW_RENDER_MS = 200;
|
||||
|
||||
@@ -233,6 +234,7 @@ export async function startInteractiveUI(
|
||||
}
|
||||
},
|
||||
alternateBuffer: settings.merged.ui?.useAlternateBuffer,
|
||||
alternateBufferAlreadyActive: settings.merged.ui?.useAlternateBuffer,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -420,6 +422,12 @@ export async function main() {
|
||||
// input showing up in the output.
|
||||
process.stdin.setRawMode(true);
|
||||
|
||||
if (settings.merged.ui?.useAlternateBuffer) {
|
||||
process.stdout.write(ansiEscapes.enterAlternativeScreen);
|
||||
|
||||
// Ink will cleanup so there is no need for us to manually cleanup.
|
||||
}
|
||||
|
||||
// This cleanup isn't strictly needed but may help in certain situations.
|
||||
process.on('SIGTERM', () => {
|
||||
process.stdin.setRawMode(wasRaw);
|
||||
|
||||
Reference in New Issue
Block a user