summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/InputPrompt.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/components/InputPrompt.tsx')
-rw-r--r--packages/cli/src/ui/components/InputPrompt.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx
index 01ed8db1..4d66b10c 100644
--- a/packages/cli/src/ui/components/InputPrompt.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.tsx
@@ -162,7 +162,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
// - Otherwise, the base is everything EXCEPT the last partial part.
const basePath =
hasTrailingSpace || isParentPath ? parts : parts.slice(0, -1);
- const newValue = `/${[...basePath, suggestion].join(' ')} `;
+ const newValue = `/${[...basePath, suggestion].join(' ')}`;
buffer.setText(newValue);
} else {
@@ -266,6 +266,12 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
return;
}
+ // If the command is a perfect match, pressing enter should execute it.
+ if (completion.isPerfectMatch && key.name === 'return') {
+ handleSubmitAndClear(buffer.text);
+ return;
+ }
+
if (completion.showSuggestions) {
if (completion.suggestions.length > 1) {
if (key.name === 'up') {