Skip to content

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

Open
@rendarz

Description

@rendarz

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.

IMG_2640.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions