nushell / nushell/reedline

When Reedline may encounter "The cursor position could not be read within a normal duration"?

Open
#870 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I wonder when Reedline may encounter the internal error "The cursor position could not be read within a normal duration".

I can't stably reproduce it but here is the structure of my code:

    let mut state = Reedline::create()
        .with_validator(Box::new(ScopeQLValidator))
        .with_highlighter(Box::new(ScopeQLHighlighter));

    loop {
        let input = state
            .read_line(&prompt)
            .change_context_lazy(|| Error::Other("failed to read next line".to_string()))?;
        let input = match input {
            Signal::CtrlC | Signal::CtrlD => {
                println!("exit");
                break;
            }
            Signal::Success(input) => input,
        };
        let input = input.trim();

        // other biz code

        state.run_edit_commands(&[EditCommand::InsertString(
            outstanding.trim_start().to_string(),
        )]);
    }

And today in Ubuntu Terminal I encounter:

thread 'main' panicked at cmd/scopeql/src/main.rs:50:78:
called `Result::unwrap()` on an `Err` value: failed to read next line
|- at cmd/scopeql/src/repl/entrypoint.rs:42:14
|
| -> The cursor position could not be read within a normal duration
    | - at cmd/scopeql/src/repl/entrypoint.rs:42:14

I have no idea when this error may occur and find no way to investigate deeper.

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 reported call path in cmd/scopeql/src/repl/entrypoint.rs:42 and the panic site in cmd/scopeql/src/main.rs:50, using the Reedline::read_line and run_edit_commands sequence shown in the issue. Reproduce the cursor-position error in Ubuntu Terminal if possible, then identify the conditions that trigger it and document or address the resulting behavior.

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
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.