fix: keep slash command suggestions visible when typing exact command names (#157)
Previously, typing "/org" would hide the suggestion immediately upon completion. Now suggestions only disappear when user presses space or Enter, making it clearer that the command is available to execute. Fixes UX issue where users lose visual confirmation of valid commands.
This commit is contained in:
parent
ee34a701ef
commit
8536dc3c8c
1 changed files with 3 additions and 3 deletions
|
|
@ -105,13 +105,13 @@ const UserInput: React.FC<UserInputProps> = ({
|
|||
const allCommands = getSlashCommands();
|
||||
const exactMatch = allCommands.find((cmd) => cmd.name === afterSlash);
|
||||
|
||||
// Hide selector if we have an exact match and there's more content after the cursor
|
||||
// Hide selector if we have an exact match and there's a space after cursor
|
||||
if (exactMatch) {
|
||||
const restOfText = text.slice(cursor);
|
||||
// If there's a space immediately after cursor, or we're at end of line/text, hide selector
|
||||
// Only hide if there's a space or newline immediately after cursor
|
||||
// Don't hide just because we're at the end - user might want to see the suggestion
|
||||
if (
|
||||
restOfText.startsWith(" ") ||
|
||||
restOfText === "" ||
|
||||
restOfText.startsWith("\n")
|
||||
) {
|
||||
setShowSlashCommands(false);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue