Skip to content

Allow rebinding the confirm key for search and prompt inputs#5642

Open
mokashang wants to merge 1 commit into
jesseduffield:masterfrom
mokashang:fix/rebindable-search-prompt-confirm
Open

Allow rebinding the confirm key for search and prompt inputs#5642
mokashang wants to merge 1 commit into
jesseduffield:masterfrom
mokashang:fix/rebindable-search-prompt-confirm

Conversation

@mokashang
Copy link
Copy Markdown

PR Description

The confirm action for the search/filter prompt and for text input prompts (e.g. when naming a stash or creating a new branch) was hard-coded to <enter> in #4860, on the assumption that nobody would want to remap it. As reported in #5510, that assumption was wrong: users who rebind keybinding.universal.confirm to something like <c-j> could no longer confirm those two prompts at all.

This adds two new keybindings, confirmSearch and confirmPrompt, following the existing convention of context-specific confirm keys (confirmMenu, confirmSuggestion, confirmInEditor). Both default to <enter>, so the behaviour is completely unchanged for users who don't remap them; users who do can now point them at whatever key they like.

Fixes #5510.

Testing: added an integration test (config/rebind_confirm_search_and_prompt) that rebinds both keys to <c-y> and verifies that a search and a text prompt can each be confirmed with the rebound key. I confirmed the test fails on master (both prompts ignore the rebound key) and passes with this change. The existing search/prompt integration tests still pass.

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (no new user-facing strings; the prompt confirm keeps the existing Confirm label)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (keybindings are re-read via resetKeybindings on config reload, same as the other confirm keys)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

The confirm action for the search/filter prompt and for text input
prompts (e.g. naming a stash or a new branch) was hard-coded to <enter>
in jesseduffield#4860, on the assumption that these wouldn't be remapped. That
assumption turned out to be wrong: users who rebind universal.confirm to
a key such as <c-j> could no longer confirm these two prompts.

Add ConfirmSearch and ConfirmPrompt keybindings, following the existing
pattern of context-specific confirm keys (confirmMenu, confirmSuggestion,
confirmInEditor). Both default to <enter>, so behaviour is unchanged for
users who don't remap them.

Fixes jesseduffield#5510
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.

Confirm search and stash binding

1 participant