Skip to content

Asyncronous prompt updates#1117

Merged
fdncred merged 4 commits into
nushell:mainfrom
philocalyst:repaint
Jul 15, 2026
Merged

Asyncronous prompt updates#1117
fdncred merged 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 nushell/nushell#18642. 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
@fdncred

fdncred commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@philocalyst is this part of/related to nushell/nushell#18334 or 100% separate?

@philocalyst

Copy link
Copy Markdown
Contributor Author

This is entirely unrelated actually! This covers prompts while that covers completions. Thanks for asking though. There will be a follow up PR in Nu once this gets merged.

Moved to a slower computer and started noticing these things :)

@fdncred

fdncred commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for the info @philocalyst. It would be good if you could take a look at nushell/nushell#18613 to see if there's anything missing that would help with this request.

@philocalyst

Copy link
Copy Markdown
Contributor Author

Hm, seems alright to me! The Nushell side will be more complex, I figure.

@fdncred
fdncred merged commit caeff8a into nushell:main Jul 15, 2026
7 checks passed
@fdncred

fdncred commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

ok, let's get on with it. :) Thanks for this. Been waiting for something like this for along time!

@fdncred

fdncred commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@philocalyst Are you planning on implementing something in nushell to take advantage of this PR?

@philocalyst

Copy link
Copy Markdown
Contributor Author

It seemed like the oh-my-posh guys were on that, but I'll follow up in a few weeks if they didn't pick it up.

@fdncred

fdncred commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

They're not writing nushell rust code. They're looking for us to support it in reedline, which we do, thanks to your PR, and then they needed a nushell command like commandline repaint or commandline set-prompt --left $record like Jan mentions here nushell/nushell#18613. So, that's what I'm hoping you have time to write.

@philocalyst

Copy link
Copy Markdown
Contributor Author

I'll do that then, yes -- do want to get my non-blocking completions PR through first. There's a more ambitious cross-cutting refactor that I want to get through, that would make the logic a bit cleaner. After that, I'll drive this through. Just don't want to split attention when it's all so close to merge.

@fdncred

fdncred commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

It's already landed. :)

@philocalyst

Copy link
Copy Markdown
Contributor Author

Yay!!! I was talking about a proper cache that I was building on top of my changes, that'll go up today.

In the meantime I'll begin thinking about this!

Apologies if this feels overwhelming, just really motivated to work on this stuff lately, exciting to see it come in to place towards a shell experience that never blocks UX!

@fdncred

fdncred commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

I'm excited too. Keep 'em coming! ❤️

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.

3 participants