Files
gemini-cli/packages/cli/src/ui/contexts/InputContext.tsx
T
2026-04-06 17:20:38 +00:00

29 lines
708 B
TypeScript

/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { createContext, useContext } from 'react';
import type { TextBuffer } from '../components/shared/text-buffer.js';
export interface InputState {
buffer: TextBuffer;
userMessages: string[];
shellModeActive: boolean;
showEscapePrompt: boolean;
copyModeEnabled: boolean | undefined;
inputWidth: number;
suggestionsWidth: number;
}
export const InputContext = createContext<InputState | null>(null);
export const useInputState = () => {
const context = useContext(InputContext);
if (!context) {
throw new Error('useInputState must be used within an InputProvider');
}
return context;
};