nushell / nushell/reedline

No operations in `until` will be handled after an `EditCommand`

Open
#644 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-EditOps A-KeybindingEmacs A-ViKeybinding
Dominant language
Rust
Stars
817
Forks
247
Avg merge
4d 14h
Merged PRs (30d)
30

Description

Describe the bug

This has showed up in a couple of occasions already, if I understand correctly this is incorrect behavior, please correct me if I'm wrong.

{
            name: move_to_line_end_or_take_history_hint
            modifier: control
            keycode: char_e
            mode: [emacs, vi_normal, vi_insert]
            event: {
                until: [
                    {send: historyhintcomplete}
                    {edit: movetolineend}
                    {send: openeditor} #TODO find out why this doesn't work
                ]
            }
        }

For instance, it should reach the third case when pressing ctrl+e on an empty buffer but it does not.

Or, similar case:

{
            name: move_to_line_start
            modifier: control
            keycode: char_a
            mode: [emacs, vi_normal, vi_insert]
            event: {
              until: [
                {edit: movetolinestart}
                {edit: movetostart} #TODO find out why this doesn't work
              ]
            }
        }

When editing a multi-line command, hitting ctrl+a brings you to the beginning of the line, but all consequent invocations return true as well even if there is no actual action performed.

How to reproduce

Try any of the aforementioned keybindings.

Expected behavior

Upon reaching the beginning or end of the line, subsequent calls should return false instead of true.

Screenshots

No response

Configuration
key value
version 0.85.0
branch
commit_hash
build_os linux-aarch64
build_target aarch64-alpine-linux-musl
rust_version rustc 1.72.1 (d5c2e9c34 2023-09-13) (Alpine Linux 1.72.1-r0)
cargo_version cargo 1.72.1
build_time 2023-09-20 19:52:50 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins
Additional context

I've considered opening the issue on the reedline repo instead but I wasn't sure. If that's a duplicate or its more appropriate to post it elsewhere, please let me know.

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 by tracing how until events process EditCommand results, focusing on the movetolineend and movetolinestart operations. Reproduce the provided Ctrl+E and Ctrl+A keybindings in a multi-line command and verify that an operation which makes no change returns false, allowing later until entries to run.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.