feat: remove redundant cancel message translations and improve message rendering

This commit is contained in:
DragonnZhang 2026-02-26 15:35:52 +08:00
parent 53a3727328
commit 54a861062c
11 changed files with 6 additions and 19 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { Box, Static, Text } from 'ink';
import { Box, Static } from 'ink';
import { HistoryItemDisplay } from './HistoryItemDisplay.js';
import { ShowMoreLines } from './ShowMoreLines.js';
import { Notifications } from './Notifications.js';
@ -13,8 +13,6 @@ import { useUIState } from '../contexts/UIStateContext.js';
import { useAppContext } from '../contexts/AppContext.js';
import { AppHeader } from './AppHeader.js';
import { DebugModeNotification } from './DebugModeNotification.js';
import { theme } from '../semantic-colors.js';
import { t } from '../../i18n/index.js';
// Limit Gemini messages to a very high number of lines to mitigate performance
// issues in the worst case if we somehow get an enormous response from Gemini.
@ -27,7 +25,6 @@ export const MainContent = () => {
const uiState = useUIState();
const {
pendingHistoryItems,
pendingSlashCommandHistoryItems,
terminalWidth,
mainAreaWidth,
staticAreaMaxItemHeight,
@ -75,11 +72,6 @@ export const MainContent = () => {
embeddedShellFocused={uiState.embeddedShellFocused}
/>
))}
{pendingSlashCommandHistoryItems.length > 0 && (
<Box paddingLeft={2}>
<Text color={theme.text.secondary}>{t('(esc to cancel)')}</Text>
</Box>
)}
<ShowMoreLines constrainHeight={uiState.constrainHeight} />
</Box>
</OverflowProvider>

View file

@ -29,7 +29,7 @@ export const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => {
</Box>
<Box flexGrow={1}>
<Text wrap="wrap" color={theme.status.warning}>
<RenderInline text={text} />
<RenderInline text={text} textColor={theme.status.warning} />
</Text>
</Box>
</Box>

View file

@ -330,7 +330,7 @@ export const ToolConfirmationMessage: React.FC<
bodyContent = (
<Box flexDirection="column" paddingX={1} marginLeft={1}>
<Text color={theme.text.link}>
<RenderInline text={infoProps.prompt} />
<RenderInline text={infoProps.prompt} textColor={theme.text.link} />
</Text>
{displayUrls && infoProps.urls && infoProps.urls.length > 0 && (
<Box flexDirection="column" marginTop={1}>

View file

@ -8,6 +8,7 @@ import type React from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../../colors.js';
import { RenderInline } from '../../utils/InlineMarkdownRenderer.js';
import { theme } from '../../semantic-colors.js';
interface WarningMessageProps {
text: string;
@ -24,7 +25,7 @@ export const WarningMessage: React.FC<WarningMessageProps> = ({ text }) => {
</Box>
<Box flexGrow={1}>
<Text wrap="wrap" color={Colors.AccentYellow}>
<RenderInline text={text} />
<RenderInline text={text} textColor={theme.status.warning} />
</Text>
</Box>
</Box>