Repository navigation
fix(cli): improve rendering on narrow terminals #3968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d175d88
0779de3
169031d
cada422
c6687db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,6 +38,10 @@ export const Composer = () => { | |||||||||||
| const isStreaming = | ||||||||||||
| uiState.streamingState === StreamingState.Responding || | ||||||||||||
| uiState.streamingState === StreamingState.WaitingForConfirmation; | ||||||||||||
| const suppressBottomLoadingIndicator = | ||||||||||||
| isStreaming && | ||||||||||||
| uiState.streamingState === StreamingState.Responding && | ||||||||||||
| uiState.terminalWidth <= 30; | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] Magic number
Suggested change
— deepseek-v4-pro via Qwen Code /review
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adopted in 7f77d8d. Extracted to |
||||||||||||
|
|
||||||||||||
| // Aggregate agent tool tokens from executing tool calls. Only changes when | ||||||||||||
| // a subagent reports progress, so it doesn't drive the animation loop. | ||||||||||||
|
|
@@ -80,7 +84,7 @@ export const Composer = () => { | |||||||||||
|
|
||||||||||||
| return ( | ||||||||||||
| <Box flexDirection="column" marginTop={1}> | ||||||||||||
| {!uiState.embeddedShellFocused && ( | ||||||||||||
| {!uiState.embeddedShellFocused && !suppressBottomLoadingIndicator && ( | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] This suppresses the whole Consider preserving a compact fallback such as — gpt-5.5 via Qwen Code /review
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — adopted the minimal-fallback approach. Composer now renders a compact
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — fixed in cada422. Switched to the existing |
||||||||||||
| <LoadingIndicator | ||||||||||||
| // Hide loading phrases when enableLoadingPhrases is explicitly false. | ||||||||||||
| // Using === false ensures phrases show by default when undefined. | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,9 @@ const MIN_COLUMN_WIDTH = 3; | |||||||||||||||||||
| /** Maximum number of lines per row before switching to vertical format */ | ||||||||||||||||||||
| const MAX_ROW_LINES = 4; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** Narrow terminals make horizontal tables unreadable and scrollback-heavy. */ | ||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] — DeepSeek/deepseek-v4-pro via Qwen Code /review
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point — the fixed 60-col floor was content-agnostic. Replaced in 0779de3 with a column-aware threshold: const minHorizontalTableWidth = Math.max(
ABSOLUTE_MIN_HORIZONTAL_TABLE_WIDTH, // 24, the readability floor
colCount * MIN_COLUMN_WIDTH + borderOverhead + SAFETY_MARGIN,
);So a 2-col table with short values now renders horizontally on a ~30-col terminal ( |
||||||||||||||||||||
| const MIN_HORIZONTAL_TABLE_WIDTH = 60; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** Safety margin to account for terminal resize races */ | ||||||||||||||||||||
| const SAFETY_MARGIN = 4; | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -392,7 +395,8 @@ export const TableRenderer: React.FC<TableRendererProps> = ({ | |||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const maxRowLines = calculateMaxRowLines(); | ||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] Consider hoisting the threshold check before column-width allocation:
Suggested change
— deepseek-v4-pro via Qwen Code /review
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adopted in 7f77d8d. Hoisted the |
||||||||||||||||||||
| const useVerticalFormat = maxRowLines > MAX_ROW_LINES; | ||||||||||||||||||||
| const useVerticalFormat = | ||||||||||||||||||||
| contentWidth < MIN_HORIZONTAL_TABLE_WIDTH || maxRowLines > MAX_ROW_LINES; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // ── Helper: Get alignment for a column ── | ||||||||||||||||||||
| const getAlign = (colIndex: number): ColumnAlign => | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
isStreaming &&在此处是冗余条件。isStreaming定义为Responding || WaitingForConfirmation,而后续又用=== Responding收窄,因此isStreaming && === Responding等价于=== Responding。冗余增加了维护风险:若未来有人扩展isStreaming的定义,会误以为此 guard 已覆盖新状态。— DeepSeek/deepseek-v4-pro via Qwen Code /review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch — accepted in 0779de3. Dropped the redundant
isStreaming &&guard. Kept the explicit=== Respondingcheck so any future expansion ofisStreaming(e.g. a newIdle-ish substate) doesn't silently widen suppression. Added a test pinning thatWaitingForConfirmationon a 25-col terminal still shows the indicator.