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 getFilteredCommands = () => {
|
||||||
const allCommands = getSlashCommands();
|
const allCommands = getSlashCommands();
|
||||||
return allCommands.filter((cmd) =>
|
return allCommands
|
||||||
cmd.name.toLowerCase().includes(slashCommandFilter.toLowerCase())
|
.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
|
// Handle slash command selection
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue