Skip to content

Commit 345df5a

Browse files
committed
fix(cli): flatten multiline custom answers in ask_user collapsed view
1 parent 4ad692d commit 345df5a

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

cli/src/components/ask-user/components/accordion-question.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ export const AccordionQuestion: React.FC<AccordionQuestionProps> = ({
6565
(isMultiSelect && (answer.selectedIndices?.size ?? 0) > 0) ||
6666
answer.selectedIndex !== undefined)
6767

68-
// Get display text for the current answer
6968
const getAnswerDisplay = (): string => {
7069
if (!answer) return '(click to answer)'
7170

7271
if (answer.isCustom && answer.customText) {
73-
return `Custom: ${answer.customText}`
72+
const flattenedText = answer.customText
73+
.replace(/\r?\n/g, ' ')
74+
.replace(/\s+/g, ' ')
75+
.trim()
76+
return `Custom: ${flattenedText}`
7477
}
7578

7679
if (isMultiSelect && answer.selectedIndices) {

cli/src/components/ask-user/components/custom-answer-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const CustomAnswerInput: React.FC<CustomAnswerInputProps> = memo(
4141
}
4242
}}
4343
focused={focused}
44-
maxHeight={3}
44+
maxHeight={5}
4545
minHeight={1}
4646
placeholder="Type your answer..."
4747
/>

cli/src/components/ask-user/components/question-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const QuestionHeader: React.FC<QuestionHeaderProps> = memo(
5050
</text>
5151
{/* Answer displayed on separate line when collapsed (like User Answers style) */}
5252
{!isExpanded && (
53-
<text style={{ marginLeft: 3 }}>
53+
<text truncate wrapMode="none" style={{ marginLeft: 3 }}>
5454
<span fg={theme.primary}></span>
5555
<span
5656
fg={isAnswered ? theme.primary : theme.muted}

0 commit comments

Comments
 (0)