Skip to content

Commit 119670c

Browse files
committed
Use full width for terminal command preview
1 parent d9efa47 commit 119670c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cli/src/components/terminal-command-display.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ interface TerminalCommandDisplayProps {
2020
cwd?: string
2121
/** Timeout in seconds for the command */
2222
timeoutSeconds?: number
23+
/** Optional width override for wrapping calculations */
24+
availableWidth?: number
2325
}
2426

2527
/**
@@ -33,10 +35,10 @@ export const TerminalCommandDisplay = ({
3335
maxVisibleLines,
3436
isRunning = false,
3537
timeoutSeconds,
38+
availableWidth,
3639
}: TerminalCommandDisplayProps) => {
3740
const theme = useTheme()
38-
const { contentMaxWidth } = useTerminalDimensions()
39-
const padding = 5
41+
const { separatorWidth } = useTerminalDimensions()
4042
const [isExpanded, setIsExpanded] = useState(false)
4143

4244
// Default max lines depends on whether expandable
@@ -77,7 +79,7 @@ export const TerminalCommandDisplay = ({
7779
}
7880

7981
// With output - calculate visual lines
80-
const width = Math.max(10, contentMaxWidth - padding * 2)
82+
const width = Math.max(10, availableWidth ?? separatorWidth)
8183
const allLines = output.split('\n')
8284

8385
// Calculate total visual lines across all output lines

cli/src/components/tools/run-terminal-command.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const parseTerminalOutput = (rawOutput: string | undefined): ParsedTermin
4949
export const RunTerminalCommandComponent = defineToolComponent({
5050
toolName: 'run_terminal_command',
5151

52-
render(toolBlock): ToolRenderConfig {
52+
render(toolBlock, _theme, options): ToolRenderConfig {
5353
// Extract command and timeout from input
5454
const input = toolBlock.input as { command?: string; timeout_seconds?: number } | undefined
5555
const command = typeof input?.command === 'string' ? input.command.trim() : ''
@@ -67,6 +67,7 @@ export const RunTerminalCommandComponent = defineToolComponent({
6767
maxVisibleLines={5}
6868
cwd={startingCwd}
6969
timeoutSeconds={timeoutSeconds}
70+
availableWidth={options.availableWidth}
7071
/>
7172
)
7273

0 commit comments

Comments
 (0)