Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually cancel/reset open forms #208

Open
IbexPeak opened this issue Apr 4, 2022 · 5 comments
Open

Manually cancel/reset open forms #208

IbexPeak opened this issue Apr 4, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@IbexPeak
Copy link
Contributor

IbexPeak commented Apr 4, 2022

Hi shibayan,

I currently have the problem that I can't cancel a form like an input form manually.

In my application a wpf window hosts a console, which is shown upon request and can be hidden using a button. If the user inputs text without pressing enter, but than hides the console, the next time the (cleared) console is displayed, the last form is still opened, and results in strange effects with the next inputs (inputs are combined with cached inputs). Creating a fresh console instance does not resolve the problem, as the input form is still open inside Sharprompt.

Currently the only solution is when the use enters "Ctrl" + "C" in combination with Prompt.ThrowExceptionOnCancel, which internally resets the form in Sharprompt. It would be nice if this reset can be called at any time from code for all open forms.

Thanks in advance!

@shibayan shibayan added the enhancement New feature or request label Apr 4, 2022
@shibayan shibayan added this to the v3.0.0 Release milestone Apr 4, 2022
@dan-kli
Copy link

dan-kli commented May 4, 2022

Hey, I would also love to have this feature.

I have a console app that sometimes receives requests from a server, in which case I would like to stop the current prompt question and start a new one with the request coming from the server.

Thanks for making this cool prompt, I was looking for something like this for a while and just came across this project this week.

@shibayan
Copy link
Owner

shibayan commented May 4, 2022

Do you think adding support for CancellationToken would fulfill your request?

I would like to refer to the API design.

@dan-kli
Copy link

dan-kli commented May 4, 2022

For my case I would think that would definitely work, all I want to do is to cancel the current prompt question and create a new one.

I guess this is also what @IbexPeak needs?

Thank you for your reply.

@IbexPeak
Copy link
Contributor Author

IbexPeak commented May 9, 2022

Sorry for the late reply, CancellationToken would be ok for me.

@hheexx
Copy link

hheexx commented May 23, 2022

CancellationToken would be nice.
Additional nice feature would be to support handilng ESC in prompts (in addition to ctrl+c).

@shibayan shibayan modified the milestones: v3.0.0 Release, Backlog Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants