feat(menu): add MenuAccept to take a completion without submitting - #1203
Merged
Merged
Conversation
`Enter` over an open menu accepts the highlighted item, but with no menu it submits the line, so nothing can be bound to "accept, then keep typing". nushell#965 tried a `SubmitOrSpace` event for a zsh-style space and had to bolt the space onto it; nushell#821 needed the same accept for an always-open menu. One event that stops after the accept covers both as a keybinding, `Multiple([MenuAccept, InsertChar ' '])`. An empty menu reports inapplicable instead of closing, since spending the keypress on an invisible menu is the bug nushell#1175 is fixing in the `Enter` arm.
This was referenced Sep 5, 2026
kronberger-droid
marked this pull request as ready for review
September 8, 2026 07:50
This was referenced Sep 9, 2026
kronberger-droid
added a commit
to nushell/nushell
that referenced
this pull request
Sep 9, 2026
## Description Bumps `reedline` from `a8e9364` to `06bf606`: - `3eb9942` fix(history): match cwd prefix literally in sqlite search (nushell/reedline#778) - `b582ddb` feat(editor): add access to the command line selection (nushell/reedline#1200) - `aae283d` feat(editor): make copy selection report failure without selection (nushell/reedline#1166) - `87f4d79` fix(painter): re-use a bottom-row prompt if the cursor returns unmoved (nushell/reedline#1201) - `1585b51` feat(menu): add MenuAccept to take a completion without submitting (nushell/reedline#1203) - `06bf606` feat(vi): read an unbound Alt-<char> as Esc then <char> (nushell/reedline#1207) `MenuAccept` is the only new event in that range, thus the second commit wires it into `reedline_config.rs`. ## User-facing changes (Release notes) Added the `MenuAccept` keybinding event. It takes the highlighted completion into the buffer and closes the menu without submitting the line.
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.
Summary
Enterover an open menu accepts the highlighted item, but the same key submits the line once no menu is open,so there is no event a user can bind to "accept the completion, then keep typing".
Two stale PRs ran into that from different sides:
#965 wanted a zsh-style space that accepts and types itself and had to invent
SubmitOrSpacefor it,#821 wanted an always-open menu and had to invent its own
MenuAcceptsoEntercould stay free for submit.This is the small shared piece:
ReedlineEvent::MenuAccept.It does what
Enterdoes while a menu is open, splice the selection and deactivate, and stops there.It reports
Inapplicablewhen no menu is active or the active one has no values,so it composes with
UntilFoundandMultiplelike the other menu events.New
ReedlineEventvariant, thus a public API addition. No default keybinding changes and no observable change for anyone not binding it.Before
Accepting a menu item is only reachable through
Enter/Submit, which submit the buffer when the menu happens to be closed.After
Space accepts the highlighted completion and types itself, and is a plain space when no menu is open.
An empty menu is left alone rather than closed, so the keypress is not spent on a menu with nothing in it,
which is the same direction #1175 takes the Enter arm.
Additional notes
Supersedes #965. First piece of #821, tracked in #356.