jdx / demand

prompt library for rust
https://docs.rs/demand
MIT License
57 stars 4 forks source link

prompts in spinner #48

Closed Vulpesx closed 6 months ago

Vulpesx commented 6 months ago

Had some issues with running prompts in Spinner.run

Fixed the spinner eating its way up the screen, also changed the clear fn since it doesn't need to clear the rest of the screen anymore.

Fixed the spinner eating the help text of Confirm, Select and MultiSelect

Updated the tests provided an example also fixed a typo.

The Input prompt still doesn't work with spinner as I want your input.

Currently, spinner eats the input prompt to I can do the same fix I did with the others, but that moves the cursor onto the next line two fixes I can think of:

roele commented 6 months ago

👍 LGTM besides the mentioned file name.

I guess what you're trying to achieve here would fall into the topic of forms (#16) which would allow you to have web-like forms where you can move focus between the inputs or even have multi-step forms. unfortunately an implementation might be non-trivial due to cursor position handling across inputs.

Another thing that would be cool, would be the ability to set the spinner title (within the closure) to indicate some progress.

Thanks a lot for the contribution!

Vulpesx commented 6 months ago

@roele

I guess what you're trying to achieve here would fall into the topic of forms (#16) which would allow you to have web-like forms where you can move focus between the inputs or even have multi-step forms. unfortunately an implementation might be non-trivial due to cursor position handling across inputs.

I think ill do the easy fix, it shouldn't affect #16, and it will add more theme options :3

Another thing that would be cool, would be the ability to set the spinner title (within the closure) to indicate some progress.

I already had working code for this, but it looks like I lost it between branches somewhere, but it was pretty simple, so I can re make it real quick it was pretty easy, should I do that in this pr or a new one

roele commented 6 months ago

👍 Great contribution. Seems to work quite well (except for some minor things) with latest changes. Will merge as soon those have been addressed.

I already had working code for this, but it looks like I lost it between branches somewhere, but it was pretty simple, so I can re make it real quick it was pretty easy, should I do that in this pr or a new one

Lets focus on the prompts and do further improvements in a new PR.

roele commented 6 months ago

Things look pretty good now, will merge this in a couple minutes. Thanks a lot for the contribution @Vulpesx!