fix: slash command tab
This commit is contained in:
parent
daa4538772
commit
ee40d8bbb4
1 changed files with 15 additions and 5 deletions
|
|
@ -73,12 +73,22 @@ const UserInput: React.FC<UserInputProps> = ({
|
|||
}
|
||||
};
|
||||
|
||||
// Get filtered commands for navigation
|
||||
// Get filtered commands for navigation - using the same sorting logic as SlashCommandUI
|
||||
const getFilteredCommands = () => {
|
||||
const allCommands = getSlashCommands();
|
||||
return allCommands.filter((cmd) =>
|
||||
cmd.name.toLowerCase().includes(slashCommandFilter.toLowerCase())
|
||||
);
|
||||
return allCommands
|
||||
.filter((cmd) =>
|
||||
cmd.name.toLowerCase().includes(slashCommandFilter.toLowerCase())
|
||||
)
|
||||
.sort((a, b) => {
|
||||
const aStartsWith = a.name.toLowerCase().startsWith(slashCommandFilter.toLowerCase());
|
||||
const bStartsWith = b.name.toLowerCase().startsWith(slashCommandFilter.toLowerCase());
|
||||
|
||||
if (aStartsWith && !bStartsWith) return -1;
|
||||
if (!aStartsWith && bStartsWith) return 1;
|
||||
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
};
|
||||
|
||||
// Handle slash command selection
|
||||
|
|
@ -291,4 +301,4 @@ const UserInput: React.FC<UserInputProps> = ({
|
|||
);
|
||||
};
|
||||
|
||||
export default UserInput;
|
||||
export default UserInput;
|
||||
Loading…
Add table
Reference in a new issue