nushell / nushell/reedline

Cursor slowdown when pressing left/right arrows and there is a lot of text in the prompt

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

Nobody has claimed this yet.

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

Description

I have just an hello world project with few lines of code:

use reedline::{DefaultPrompt, DefaultPromptSegment, Reedline, Signal};


fn main() {
	let mut line_editor = Reedline::create();
	let prompt = DefaultPrompt::new(DefaultPromptSegment::Basic("ok".to_string()), DefaultPromptSegment::Empty);

	loop {
            let sig = line_editor.read_line(&prompt);
            match sig {
                Ok(Signal::Success(buffer)) => {
                    println!("We processed: {}", buffer);
                 },
                Ok(Signal::CtrlD) | Ok(Signal::CtrlC) => {
                    println!("\nAborted!");
                    break;
                 },
                 _ => { },
             }
         }
    }	
}

When I run this very simple project, with a very short text prompt, I have noticed that when I press the left or right arrows, there is some kind of delay - internally - that makes the cursor not responsive!
Indeed, if I leave the arrow keys, I noticed that the cursor is still moving, and doesn't stop immediately.
Again, it's like there is a little and subtle delay, but very annoying.
I've attached a video to show this, as you can see from the video, when I leave my finger from the arrow key, the cursor is still moving...
NOTE: This DOES NOT happen with other command-lines prompt crates.

https://github.com/nushell/reedline/assets/12814431/c77d4c7d-5766-4d83-ad85-0fd1110cdee1

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 reproducing the delay with the Rust example in the issue, then investigate the arrow-key handling and cursor movement while editing a long prompt. The issue names no source files or tests; done means left/right movement stops promptly when the key is released without regressing normal prompt editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.