2025-11-11 07:50:11 -08:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2026-02-27 07:55:02 -08:00
|
|
|
import { useConfig } from '../contexts/ConfigContext.js';
|
|
|
|
|
import type { Config } from '@google/gemini-cli-core';
|
2025-11-12 21:17:46 -08:00
|
|
|
|
2026-04-02 17:39:49 -07:00
|
|
|
// This method is intentionally misleading while we migrate.
|
|
|
|
|
// Once getUseTerminalBuffer() is always enabled we will refactor to remove
|
|
|
|
|
// all instances of this method making it the only path.
|
|
|
|
|
// Right now this is convenient as it allows us to special case terminalBuffer
|
|
|
|
|
// rendering like we special case alternateBuffer rendering.
|
2026-02-27 07:55:02 -08:00
|
|
|
export const isAlternateBufferEnabled = (config: Config): boolean =>
|
2026-04-02 17:39:49 -07:00
|
|
|
config.getUseAlternateBuffer() || config.getUseTerminalBuffer();
|
2025-11-11 07:50:11 -08:00
|
|
|
|
2026-02-27 07:55:02 -08:00
|
|
|
// This is read from Config so that the UI reads the same value per application session
|
2025-11-11 07:50:11 -08:00
|
|
|
export const useAlternateBuffer = (): boolean => {
|
2026-02-27 07:55:02 -08:00
|
|
|
const config = useConfig();
|
|
|
|
|
return isAlternateBufferEnabled(config);
|
2025-11-11 07:50:11 -08:00
|
|
|
};
|