Skip to content

Conversation

red-stronghold
Copy link

@red-stronghold red-stronghold commented Oct 14, 2025

fixes #851
fixes #1392

  • I have read the Contribution Guidelines
  • I have commented on the issue above and discussed the intended changes
  • A maintainer has signed off on the changes and the issue was assigned to me
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors
  • The documentation was modified to reflect the changes OR no documentation changes are required.

Changes

For SelectionPrompt<T>:

  • Allow setting a Func<T> property to be triggered on Cancel
  • Extension methods to set the property, either with a Func or with a Value (for easier use)
  • Capture 'ESC' key and cancel the prompt
  • Return the specified result if the prompt is cancelled
  • Unit tests to cover both extension methods.

For MultiSelectionPrompt<T>:

  • Allow setting a Func<List<T>> property to be triggered on Cancel
  • Extension methods to set the property, either with a Func, a List, a Value or an empty List (for easier use)
  • Capture 'ESC' key and cancel the prompt
  • Return the specified result if the prompt is cancelled
  • Unit tests to cover all extension methods.

If property not set, the prompts works as before.


Please upvote 👍 this pull request if you are interested in it.

@red-stronghold
Copy link
Author

@red-stronghold please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

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.

Allow user to cancel input during Prompt() Esc Key to exit selection

1 participant