Skip to content

Add Y bounds check to InvokePrompt (Fixes #4790) #4791

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jftkcs
Copy link

@jftkcs jftkcs commented Jun 17, 2025

PR Summary

Aligns behavior with that stated in issue #4790:

  • Add a bounds check to make calls to InvokePrompt silently return if it's not possible to redraw the entire prompt and no Y position was specified by the caller.
  • Check and directly throw an exception if a call is made to InvokePrompt with an explicit Y position that is not possible.

Since implicit callers (i.e. those not specifying a Y position) can't know where the prompt will get written, they can't guard against accidentally trying to update a prompt that's left the buffer. The only thing that can be done by anyone once the prompt has left the screen is to accept the line or abort.

Explicit callers passing a Y value in 'arg' at least know where they are trying to write the prompt so we can throw the exception and let them handle/recover (if desired).

PR Checklist

Microsoft Reviewers: Open in CodeFlow

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.

1 participant