nushell / nushell/reedline

New actions to cancel menu & accept-and-hold

Open
#767 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
817
Forks
247
Avg merge
4d 14h
Merged PRs (30d)
30

Description

Hello o/

When using the vi mode, when the completion menu is open, there is no way to cancel/hide the menu while staying in insert mode (pressing escape will hide the menu but also go to normal mode which I ~never want).
👉 I'd like to have a MenuCancel action to cancel the menu without changing the current mode.

Related to that, if I type echo f in a directory with files foobar & foobaz, the input will be changed to foo (the longest common text of the completion candidates), then when pressing escape to try to cancel the menu, the original input is not restored (I am left with echo foo instead of echo f.
I don't know if this should be filed as a bug report, but MenuCancel should restore the original input 🙏

video showing this behavior(/bug?)

https://github.com/nushell/reedline/assets/9730330/00709df8-2041-4439-85a1-e5b3fc2606af


Another menu action I'd I'm found of in zsh is the ability to accept current completion but keep the exact same completion menu open (and moving the selected completion to the next).
👉 I'd like to have MenuAcceptAndHold to accept current selection, append a space + what was used for previous completion and continue showing the completion menu.
Selecting the next entry could be moved avoided if we can execute multiple actions in a keybinding 🤔
(note: related to #624 asking for something like a MenuAccept action)

video showing this behavior in zsh

https://github.com/nushell/reedline/assets/9730330/af4902ed-ab2f-423c-b202-8a7e8fd6fff2

References

Zsh Line Editor (ZLE) has bindable actions do that:

  • send-break to cancel current editor function (e.g. the completion menu)
  • accept-and-hold to accept current selection but keep completion menu open

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the vi-mode completion menu and the existing action and keybinding entry points. Define how MenuCancel restores the original input without changing mode, and how MenuAcceptAndHold accepts the current selection while keeping the menu open; verify both behaviors against the examples in the issue and the related #624 request.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.