Asyncronous prompt updates#1117
Conversation
experimented with using the flag directly and found it hard to read
There was a problem hiding this comment.
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
RepaintSignalhandle 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.
|
Resolved comments |
…ting logic think that the refactor makes it overall more readable, and for me, isolates concerns
|
@philocalyst is this part of/related to nushell/nushell#18334 or 100% separate? |
|
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 :) |
|
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. |
|
Hm, seems alright to me! The Nushell side will be more complex, I figure. |
|
ok, let's get on with it. :) Thanks for this. Been waiting for something like this for along time! |
|
@philocalyst Are you planning on implementing something in nushell to take advantage of this PR? |
|
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. |
|
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 |
|
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. |
|
It's already landed. :) |
|
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! |
|
I'm excited too. Keep 'em coming! ❤️ |
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:
Additional notes