mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 13:34:15 -07:00
Switch to alternate buffer mode before rendering Ink. (#12833)
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
"fzf": "^0.5.2",
|
||||
"glob": "^10.4.5",
|
||||
"highlight.js": "^11.11.1",
|
||||
"ink": "npm:@jrichman/ink@6.4.1",
|
||||
"ink": "npm:@jrichman/ink@6.4.2",
|
||||
"ink-gradient": "^3.0.0",
|
||||
"ink-spinner": "^5.0.0",
|
||||
"latest-version": "^9.0.0",
|
||||
|
||||
@@ -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