@@ -27,6 +27,12 @@ export const SuggestionMenu = ({
2727 return null
2828 }
2929
30+ const effectivePrefix = prefix ?? ''
31+ const maxLabelLength = items . reduce ( ( max , item ) => {
32+ const totalLength = effectivePrefix . length + item . label . length
33+ return totalLength > max ? totalLength : max
34+ } , 0 )
35+
3036 const clampedSelected = Math . min (
3137 Math . max ( selectedIndex , 0 ) ,
3238 Math . max ( items . length - 1 , 0 ) ,
@@ -63,6 +69,13 @@ export const SuggestionMenu = ({
6369 { visibleItems . map ( ( item , idx ) => {
6470 const absoluteIndex = start + idx
6571 const isSelected = absoluteIndex === clampedSelected
72+ const labelLength = effectivePrefix . length + item . label . length
73+ const paddingLength = Math . max ( maxLabelLength - labelLength + 2 , 2 )
74+ const padding = ' ' . repeat ( paddingLength )
75+ const textColor = isSelected ? theme . agentContentText : theme . inputFg
76+ const descriptionColor = isSelected
77+ ? theme . agentContentText
78+ : theme . timestampUser
6679 return (
6780 < box
6881 key = { item . id }
@@ -74,31 +87,22 @@ export const SuggestionMenu = ({
7487 paddingTop : 0 ,
7588 paddingBottom : 0 ,
7689 backgroundColor : isSelected
77- ? theme . inputFocusedBg
90+ ? theme . agentFocusedBg
7891 : theme . messageBg ,
7992 width : '100%' ,
8093 } }
8194 >
8295 < text
8396 wrap = { false }
8497 style = { {
85- fg : isSelected ? theme . inputFocusedFg : theme . inputFg ,
98+ fg : textColor ,
8699 marginBottom : 0 ,
87100 } }
88101 >
89- < span fg = { theme . agentPrefix } >
90- { prefix ?? '/' }
91- </ span >
102+ < span fg = { theme . agentPrefix } > { effectivePrefix } </ span >
92103 < span > { item . label } </ span >
93- </ text >
94- < text
95- wrap = { false }
96- style = { {
97- fg : isSelected ? theme . agentContentText : theme . timestampUser ,
98- marginBottom : 0 ,
99- } }
100- >
101- { item . description }
104+ < span > { padding } </ span >
105+ < span fg = { descriptionColor } > { item . description } </ span >
102106 </ text >
103107 </ box >
104108 )
0 commit comments