Skip to content

Commit e63160c

Browse files
committed
Revert "cli: Tweak display layout for suggestion menu"
This reverts commit ae056a7.
1 parent d576e74 commit e63160c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cli/src/components/suggestion-menu.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ export const SuggestionMenu = ({
6767
),
6868
)
6969

70-
// Account for button padding (paddingLeft + paddingRight = 2)
71-
const availableWidth = menuWidth - 2
70+
// Find the longest description to determine if we can use same-line layout
71+
const maxDescriptionLength = Math.max(
72+
...visibleItems.map((item) => item.description.length),
73+
)
74+
75+
// Check if all items can fit on same line with aligned descriptions
76+
const minWidthForSameLine = maxLabelLength + 2 + maxDescriptionLength
77+
const useSameLine = menuWidth >= minWidthForSameLine
7278

7379
const renderSuggestionItem = (item: SuggestionItem, idx: number) => {
7480
const absoluteIndex = start + idx
@@ -86,10 +92,7 @@ export const SuggestionMenu = ({
8692
setHasHoveredSinceOpen(true)
8793
}
8894

89-
// Check per-item if description fits on the same line (using maxLabelLength for alignment padding)
90-
const itemFitsOnSameLine = availableWidth >= maxLabelLength + 2 + item.description.length
91-
92-
if (itemFitsOnSameLine) {
95+
if (useSameLine) {
9396
// Calculate padding to align descriptions
9497
const paddingLength = maxLabelLength - labelLength
9598
const padding = ' '.repeat(paddingLength)

0 commit comments

Comments
 (0)