Make Enter accept the highlighted slash command (fixes picker Enter)#364
Draft
dannon wants to merge 1 commit into
Draft
Make Enter accept the highlighted slash command (fixes picker Enter)#364dannon wants to merge 1 commit into
dannon wants to merge 1 commit into
Conversation
… 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
a7de52c to
71257c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
acceptSlashPopup(...), closes the popup, then submits, instead of falling through to the raw-submit path.acceptSlashPopupdispatches aninputevent that can transiently re-open the popup for a no-arg command, so we close it again beforesubmit()-- mirroring the existing raw path.shouldAcceptSlashCommandOnEnter) with unit tests, following the existinginput-history-navpattern.Behavior / scope
maybeOpenSlashPopupsets it), and a fully-typed command is itself that highlighted row, so accept+submit re-runs the same command (submit()trims the trailing spaceacceptSlashPopupmay add for arg-bearing commands).!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.Testing
npm test: green (1255 passed); newtests/slash-popup-nav.test.tspins 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)./, 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.