diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index ea8482a161..54684a8c2c 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -5,34 +5,15 @@ */ import { useIsScreenReaderEnabled } from 'ink'; -import { useTerminalSize } from './hooks/useTerminalSize.js'; -import { lerp } from '../utils/math.js'; import { useUIState } from './contexts/UIStateContext.js'; import { StreamingContext } from './contexts/StreamingContext.js'; import { QuittingDisplay } from './components/QuittingDisplay.js'; import { ScreenReaderAppLayout } from './layouts/ScreenReaderAppLayout.js'; import { DefaultAppLayout } from './layouts/DefaultAppLayout.js'; -const getContainerWidth = (terminalWidth: number): string => { - if (terminalWidth <= 80) { - return '98%'; - } - if (terminalWidth >= 132) { - return '90%'; - } - - // Linearly interpolate between 80 columns (98%) and 132 columns (90%). - const t = (terminalWidth - 80) / (132 - 80); - const percentage = lerp(98, 90, t); - - return `${Math.round(percentage)}%`; -}; - export const App = () => { const uiState = useUIState(); const isScreenReaderEnabled = useIsScreenReaderEnabled(); - const { columns } = useTerminalSize(); - const containerWidth = getContainerWidth(columns); if (uiState.quittingMessages) { return ; @@ -40,11 +21,7 @@ export const App = () => { return ( - {isScreenReaderEnabled ? ( - - ) : ( - - )} + {isScreenReaderEnabled ? : } ); }; diff --git a/packages/cli/src/ui/components/ContextUsageDisplay.tsx b/packages/cli/src/ui/components/ContextUsageDisplay.tsx index 25dad9c7e3..d7d8c063f0 100644 --- a/packages/cli/src/ui/components/ContextUsageDisplay.tsx +++ b/packages/cli/src/ui/components/ContextUsageDisplay.tsx @@ -11,21 +11,15 @@ import { tokenLimit } from '@google/gemini-cli-core'; export const ContextUsageDisplay = ({ promptTokenCount, model, - terminalWidth, }: { promptTokenCount: number; model: string; - terminalWidth: number; }) => { const percentage = promptTokenCount / tokenLimit(model); - const percentageLeft = ((1 - percentage) * 100).toFixed(0); - - const label = terminalWidth < 100 ? '%' : '% context left'; return ( - ({percentageLeft} - {label}) + ({((1 - percentage) * 100).toFixed(0)}% context left) ); }; diff --git a/packages/cli/src/ui/components/Footer.test.tsx b/packages/cli/src/ui/components/Footer.test.tsx index 31f256d5c6..3c0a4d9b96 100644 --- a/packages/cli/src/ui/components/Footer.test.tsx +++ b/packages/cli/src/ui/components/Footer.test.tsx @@ -9,6 +9,7 @@ import { describe, it, expect, vi } from 'vitest'; import { Footer } from './Footer.js'; import * as useTerminalSize from '../hooks/useTerminalSize.js'; import { tildeifyPath } from '@google/gemini-cli-core'; +import path from 'node:path'; import { type UIState, UIStateContext } from '../contexts/UIStateContext.js'; import { ConfigContext } from '../contexts/ConfigContext.js'; import { SettingsContext } from '../contexts/SettingsContext.js'; @@ -102,22 +103,34 @@ describe('