fix: keep slash highlight in sync in fullscreen
This commit is contained in:
@@ -58,15 +58,13 @@ const SuggestionItemRow = memo(function SuggestionItemRow({
|
|||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
const columns = useTerminalSize().columns
|
const columns = useTerminalSize().columns
|
||||||
const selectionPrefix = isSelected ? SELECTED_PREFIX : UNSELECTED_PREFIX
|
const selectionPrefix = isSelected ? SELECTED_PREFIX : UNSELECTED_PREFIX
|
||||||
|
const rowBackgroundColor: keyof Theme | undefined = isSelected
|
||||||
|
? 'suggestion'
|
||||||
|
: undefined
|
||||||
|
const textColor: keyof Theme | undefined = isSelected ? 'inverseText' : undefined
|
||||||
|
|
||||||
if (isUnifiedSuggestion(item.id)) {
|
if (isUnifiedSuggestion(item.id)) {
|
||||||
const icon = getIcon(item.id)
|
const icon = getIcon(item.id)
|
||||||
const textColor: keyof Theme | undefined = isSelected
|
|
||||||
? 'inverseText'
|
|
||||||
: undefined
|
|
||||||
const backgroundColor: keyof Theme | undefined = isSelected
|
|
||||||
? 'suggestion'
|
|
||||||
: undefined
|
|
||||||
const dimColor = !isSelected
|
const dimColor = !isSelected
|
||||||
const isFile = item.id.startsWith('file-')
|
const isFile = item.id.startsWith('file-')
|
||||||
const isMcpResource = item.id.startsWith('mcp-resource-')
|
const isMcpResource = item.id.startsWith('mcp-resource-')
|
||||||
@@ -113,15 +111,11 @@ const SuggestionItemRow = memo(function SuggestionItemRow({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Text
|
<Box width="100%" opaque={true} backgroundColor={rowBackgroundColor}>
|
||||||
color={textColor}
|
<Text color={textColor} dimColor={dimColor} bold={isSelected} wrap="truncate">
|
||||||
backgroundColor={backgroundColor}
|
|
||||||
dimColor={dimColor}
|
|
||||||
bold={isSelected}
|
|
||||||
wrap="truncate"
|
|
||||||
>
|
|
||||||
{lineContent}
|
{lineContent}
|
||||||
</Text>
|
</Text>
|
||||||
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,10 +124,7 @@ const SuggestionItemRow = memo(function SuggestionItemRow({
|
|||||||
maxColumnWidth ?? stringWidth(item.displayText) + 5,
|
maxColumnWidth ?? stringWidth(item.displayText) + 5,
|
||||||
maxNameWidth,
|
maxNameWidth,
|
||||||
)
|
)
|
||||||
const textColor = isSelected ? 'inverseText' : item.color
|
const displayTextColor = isSelected ? 'inverseText' : item.color
|
||||||
const backgroundColor: keyof Theme | undefined = isSelected
|
|
||||||
? 'suggestion'
|
|
||||||
: undefined
|
|
||||||
const shouldDim = !isSelected
|
const shouldDim = !isSelected
|
||||||
|
|
||||||
let displayText = item.displayText
|
let displayText = item.displayText
|
||||||
@@ -156,32 +147,21 @@ const SuggestionItemRow = memo(function SuggestionItemRow({
|
|||||||
: ''
|
: ''
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Box width="100%" opaque={true} backgroundColor={rowBackgroundColor}>
|
||||||
<Text wrap="truncate">
|
<Text wrap="truncate">
|
||||||
<Text
|
<Text color={displayTextColor} dimColor={shouldDim} bold={isSelected}>
|
||||||
color={textColor}
|
|
||||||
backgroundColor={backgroundColor}
|
|
||||||
dimColor={shouldDim}
|
|
||||||
bold={isSelected}
|
|
||||||
>
|
|
||||||
{paddedDisplayText}
|
{paddedDisplayText}
|
||||||
</Text>
|
</Text>
|
||||||
{tagText ? (
|
{tagText ? (
|
||||||
<Text
|
<Text color={textColor} dimColor={!isSelected}>
|
||||||
color={isSelected ? 'inverseText' : undefined}
|
|
||||||
backgroundColor={backgroundColor}
|
|
||||||
dimColor={!isSelected}
|
|
||||||
>
|
|
||||||
{tagText}
|
{tagText}
|
||||||
</Text>
|
</Text>
|
||||||
) : null}
|
) : null}
|
||||||
<Text
|
<Text color={textColor} dimColor={!isSelected}>
|
||||||
color={isSelected ? 'inverseText' : undefined}
|
|
||||||
backgroundColor={backgroundColor}
|
|
||||||
dimColor={!isSelected}
|
|
||||||
>
|
|
||||||
{truncatedDescription}
|
{truncatedDescription}
|
||||||
</Text>
|
</Text>
|
||||||
</Text>
|
</Text>
|
||||||
|
</Box>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -226,7 +206,7 @@ export function PromptInputFooterSuggestions({
|
|||||||
>
|
>
|
||||||
{visibleItems.map(item => (
|
{visibleItems.map(item => (
|
||||||
<SuggestionItemRow
|
<SuggestionItemRow
|
||||||
key={item.id}
|
key={`${item.id}:${item.id === suggestions[selectedSuggestion]?.id ? 'selected' : 'idle'}`}
|
||||||
item={item}
|
item={item}
|
||||||
maxColumnWidth={maxColumnWidth}
|
maxColumnWidth={maxColumnWidth}
|
||||||
isSelected={item.id === suggestions[selectedSuggestion]?.id}
|
isSelected={item.id === suggestions[selectedSuggestion]?.id}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user