Skip to content

Make Enter accept the highlighted slash command (fixes picker Enter)#364

Draft
dannon wants to merge 1 commit into
galaxyproject:mainfrom
dannon:fix/287-command-picker-enter
Draft

Make Enter accept the highlighted slash command (fixes picker Enter)#364
dannon wants to merge 1 commit into
galaxyproject:mainfrom
dannon:fix/287-command-picker-enter

Conversation

@dannon

@dannon dannon commented Jun 26, 2026

Copy link
Copy Markdown
Member

Closes #287.

Opening the slash-command picker and pressing Enter submitted the raw typed text (e.g. the literal /) instead of running the highlighted command -- you had to Tab to complete first, then Enter. This makes Enter behave like Tab+Enter: it completes the highlighted command and runs it, matching standard autocomplete (VS Code palette, shell completion).

What changed

  • In the chat input's keydown handler, the open-popup branch now handles Enter: on a highlighted row it calls acceptSlashPopup(...), closes the popup, then submits, instead of falling through to the raw-submit path. acceptSlashPopup dispatches an input event that can transiently re-open the popup for a no-arg command, so we close it again before submit() -- mirroring the existing raw path.
  • Pulled the accept-on-Enter decision into a small pure helper (shouldAcceptSlashCommandOnEnter) with unit tests, following the existing input-history-nav pattern.
  • Updated the now-stale comments that documented the old "Tab completes / Enter submits raw" design.

Behavior / scope

  • Fully-typed command + Enter still runs. When the popup is open it always highlights row 0 (maybeOpenSlashPopup sets it), and a fully-typed command is itself that highlighted row, so accept+submit re-runs the same command (submit() trims the trailing space acceptSlashPopup may add for arg-bearing commands).
  • Arg-bearing commands. Per the issue ("select + run"), Enter on a highlighted command runs it; one that needs an argument surfaces its usage, same as submitting a bare command does today. Use Tab to complete-without-running and then type args.
  • Shift+Enter still inserts a newline (both Enter paths require !e.shiftKey), so multi-line input and the ArrowUp recalls prompt history instead of moving the cursor up within a multi-line chat input #314 ArrowUp recall behavior are untouched.
  • IME composition. An Enter that commits an IME composition now bails early (a single guard at the top of the handler), so it's never treated as a submit on either Enter path.

Testing

  • npm test: green (1255 passed); new tests/slash-popup-nav.test.ts pins the helper contract.
  • cd app && npx tsc --noEmit: no new errors (renderer files clean; the pre-existing main/preload electron-type errors are unchanged by this diff).
  • Not yet live-eyeballed in Orbit. Manual check to run: type /, arrow to a command, press Enter -> the highlighted command should run (previously submitted the raw /); confirm Shift+Enter still inserts a newline and a fully-typed command + Enter still runs.

Note: the pure-helper test covers the accept/skip decision but not the DOM keydown flow itself (the renderer handler isn't reachable from the node test harness) -- the close-ordering, Shift+Enter, and IME behavior are covered by the manual check above.

Reviewed adversarially over two passes; the only flagged correctness issue (Enter during IME composition still hitting the raw submit path) is fixed here.

… raw text

When the command picker is open, Enter now completes the highlighted command
and runs it -- Tab+Enter in one keystroke -- which is the autocomplete behavior
people expect (VS Code palette, shell completion). A fully-typed command is
itself the highlighted row, so it still runs; Shift+Enter still inserts a
newline. An Enter that commits an IME composition bails early so it's never
treated as a submit. The accept-on-Enter decision lives in a small pure helper
so it's unit-tested.

Closes galaxyproject#287
@dannon dannon force-pushed the fix/287-command-picker-enter branch from a7de52c to 71257c7 Compare June 26, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orbit command picker: Enter submits raw text instead of the highlighted command

1 participant