Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/cli/src/ui/components/HistoryItemDisplay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vi.mock('../hooks/useMouseEvents.js', () => ({
useMouseEvents: vi.fn(),
}));

const toggleKeyHint = process.platform === 'darwin' ? '\u2325+t' : 'alt+t';

describe('<HistoryItemDisplay />', () => {
const mockConfig = {
getChatRecordingService: () => undefined,
Expand Down Expand Up @@ -358,7 +360,7 @@ describe('<HistoryItemDisplay />', () => {

const output = lastFrame() ?? '';
expect(output).toContain('Thought for');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Inspecting the repository');
});

Expand Down Expand Up @@ -394,7 +396,7 @@ describe('<HistoryItemDisplay />', () => {

const output = lastFrame() ?? '';
expect(output).toContain('Thought for');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Inspecting the repository');
});

Expand All @@ -414,7 +416,7 @@ describe('<HistoryItemDisplay />', () => {

const output = lastFrame() ?? '';
expect(output).toContain('Thought for');
expect(output).toContain('alt+t to collapse');
expect(output).toContain(`${toggleKeyHint} to collapse`);
expect(output).toContain('Inspecting the repository');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import { render } from 'ink-testing-library';
import { ThinkMessage, ThinkMessageContent } from './ConversationMessages.js';

const toggleKeyHint = process.platform === 'darwin' ? '\u2325+t' : 'alt+t';

describe('<ThinkMessage />', () => {
const defaultProps = {
text: 'Analyzing the code structure',
Expand All @@ -19,7 +21,7 @@ describe('<ThinkMessage />', () => {
);
const output = lastFrame();
expect(output).toContain('Thinking');
expect(output).not.toContain('alt+t to expand');
expect(output).not.toContain(`${toggleKeyHint} to expand`);
});

it('should render collapsed line when committed and not expanded', () => {
Expand All @@ -28,7 +30,7 @@ describe('<ThinkMessage />', () => {
);
const output = lastFrame();
expect(output).toContain('Thinking');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Analyzing the code structure');
});

Expand All @@ -45,7 +47,7 @@ describe('<ThinkMessage />', () => {
<ThinkMessage {...defaultProps} isPending={false} />,
);
const output = lastFrame();
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Analyzing the code structure');
});

Expand All @@ -61,7 +63,7 @@ describe('<ThinkMessage />', () => {
const output = lastFrame();
expect(output).toContain('Thought for');
expect(output).toContain('15s');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
});

it('should show present-tense duration while pending (streaming)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ export const ThinkMessage: React.FC<ThinkMessageProps> = ({
const durationSuffix =
durationMs != null ? ` ${formatDuration(durationMs)}` : '';

const toggleKeyHint = process.platform === 'darwin' ? '\u2325+t' : 'alt+t';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The Unicode ⌥ (\u2325) symbol breaks the existing CLI key-hint convention. KeyboardShortcuts.tsx exclusively uses ASCII labels (alt+v, cmd+v, ctrl+o) — zero unicode modifier symbols anywhere in packages/cli/src/. This creates UI inconsistency: macOS users see ⌥+t in the thinking hint but alt+v in the keyboard shortcuts panel.

Additionally, the same toggleKeyHint expression is copy-pasted in 3 files (ConversationMessages.tsx, HistoryItemDisplay.test.tsx, ConversationMessages.test.tsx). If the hint text or platform logic ever changes, all 3 must be updated in lockstep.

Consider using alt+t on all platforms to match the existing convention, or extract this to a shared constant if introducing unicode symbols is intentional.

— qwen3.7-max via Qwen Code /review


if (!isPending && !expanded) {
const label =
durationMs != null
Expand All @@ -329,7 +331,7 @@ export const ThinkMessage: React.FC<ThinkMessageProps> = ({
return (
<Text dimColor italic>
{THINKING_ICON}
{label} {t('(alt+t to expand)')}
{label} {t(`(${toggleKeyHint} to expand)`)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The template literal inside t() produces two distinct translation keys per platform: "(⌥+t to expand)" on macOS and "(alt+t to expand)" elsewhere. When a translator later adds a locale entry for one key, the other platform silently falls back to English.

The t() function already supports {{param}} interpolation (i18n/index.ts:214-222). Use a stable key with a parameter:

Suggested change
{label} {t(`(${toggleKeyHint} to expand)`)}
{label} {t('({{keyHint}} to expand)', { keyHint: toggleKeyHint })}

This way translators work with one key ("({{keyHint}} to expand)") and the platform-specific value is injected at render time. Apply the same fix to the collapse variant below.

— qwen3.7-max via Qwen Code /review

</Text>
);
}
Expand Down Expand Up @@ -370,7 +372,7 @@ export const ThinkMessage: React.FC<ThinkMessageProps> = ({
<Box flexDirection="column">
<Text dimColor italic>
{THINKING_ICON}
{expandedLabel} {t('(alt+t to collapse)')}
{expandedLabel} {t(`(${toggleKeyHint} to collapse)`)}
</Text>
<Box paddingLeft={2} flexDirection="column">
<MarkdownDisplay
Expand Down
Loading