Repository navigation
fix: support enter as the accept suggestion binding - #489
Closed
Caner Patır (CanerPatir) wants to merge 1 commit into
Closed
Caner Patır (CanerPatir) wants to merge 1 commit into
Caner Patır (CanerPatir) wants to merge 1 commit into
Conversation
When acceptSuggestion is bound to "return", accepting a suggestion also cleared the tracked command because update() reset the command state on every enter before evaluating bindings. Suggestions then stopped showing for the rest of the line. Clear the command on enter only when the key press was not consumed by a binding. With enter bound to accept, pressing it on an empty token now runs the command unless a suggestion was explicitly selected with the navigation keys, so a completed line can still be executed with enter.
Caner Patır (CanerPatir)
deleted the
fix/enter-accept-keeps-command-state
branch
October 15, 2026 13:23
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.
Problem
Binding
acceptSuggestiontoreturnin the config does not work as expected:Accepting a suggestion with enter (e.g.
git chec→checkout) inserts it, but no further suggestions are shown for the rest of the line (branches never appear aftergit checkout). Withtab, the same flow works.SuggestionManager.update()callsterm.clearCommand()on every enter before evaluating bindings, so the tracked command is reset even when enter is consumed as the accept key.Fix
git checkout feature-x) can't be executed with enter, because the next-argument suggestions are always visible.Behavior with the default
tabbinding is unchanged.Testing
src/tests/utils/suggestionManager.test.tscovering accept-on-enter, enter not consumed by a binding, enter on an empty token, and enter after navigating. The accept-on-enter test fails without the fix.npm testand lint pass.git chec⏎ →git checkoutwith branch suggestions,f↓ ⏎ →git checkout feature-beta, ⏎ → command runs.