Skip to content

Asyncronous prompt updates#1117

Open
philocalyst wants to merge 4 commits into
nushell:mainfrom
philocalyst:repaint
Open

Asyncronous prompt updates#1117
philocalyst wants to merge 4 commits into
nushell:mainfrom
philocalyst:repaint

Conversation

@philocalyst

@philocalyst philocalyst commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

So this fixes my own issue #1045. It's meant to be composed with an upcoming Nushell PR, which I will link here when I have it up. My biggest motivation is that I'm working on changes to starship that should bring these different kinds of prompts to users, and nushell is my daily driver. Wanted it here too, of course :0

Before

Before this, there existed no way to repaint the prompt after the first pass.

After

After this, the mechanism exists for repainting, opening use-cases for things like:

  • An accurate time prompt
  • Asynchronus git status (non-blocking)
  • Gradient madness??

Additional notes

  • I noticed that other features, like external_printer are gated, not sure if that should be the case here too.
  • We don't have any real integration tests against a PTY which I was surprised to see, which makes true testing here hard, but I did verify myself.

experimented with using the flag directly and found it hard to read
@philocalyst philocalyst marked this pull request as ready for review July 10, 2026 15:37
@fdncred fdncred requested a review from Copilot July 10, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an asynchronous repaint mechanism to Reedline so the prompt can be re-evaluated and redrawn in-place while read_line() is active, enabling non-blocking prompt updates (e.g., async git status).

Changes:

  • Introduces a new public RepaintSignal handle for requesting a prompt repaint from another thread.
  • Updates the input loop to periodically poll for repaint requests (and repaint when requested).
  • Adds unit tests validating repaint request consumption, handle sharing behavior, and polling activation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/engine.rs Outdated
Comment thread src/engine.rs
@philocalyst

Copy link
Copy Markdown
Contributor Author

Resolved comments

…ting logic

think that the refactor makes it overall more readable, and for me,
isolates concerns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants