Skip to content

Bring back WriteWithPrompt() #1781

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

Merged
merged 3 commits into from
Apr 28, 2022

Conversation

SeeminglyScience
Copy link
Collaborator

We were running into a situation where we'd print the prompt on the same line that we had previously printed it. This was especially noticable when stepping through the debugger.

This change ensures that we always write a new line if that situation occurs.

Examples:

image

image

We were running into a situation where we'd print the prompt on the same
line that we had previously printed it. This was especially noticable
when stepping through the debugger.

This change ensures that we always write a new line if that situation
occurs.
@SeeminglyScience SeeminglyScience requested a review from a team April 28, 2022 16:01
@andyleejordan
Copy link
Member

I'm curious, does this problem go away if we write a line after invoking readline if the task has been canceled?

See this part of the change (which was what allowed us to "re-use" the existing prompt for F5 and F8 input):
Screen Shot 2022-04-28 at 9 50 30 AM

@andyleejordan
Copy link
Member

Do we just want to bring WriteWithPrompt back? It's not the worst thing in the world, it's just annoying to have a (probably empty) prompt, and then hit F5 and have a new prompt be printed with the script it's about to run.

@SeeminglyScience
Copy link
Collaborator Author

I'm curious, does this problem go away if we write a line after invoking readline if the task has been canceled?

See this part of the change (which was what allowed us to "re-use" the existing prompt for F5 and F8 input):

Yeah probably. I wonder why that works for you if you're not setting cursor left to zero somewhere...

That said I don't know if we want to reuse the prompt even if we have the option. That might need to be opt in otherwise it may confuse some folks. But we'd need to skip writing the prompt as well for that to work I'd think

@andyleejordan
Copy link
Member

That work as "expected" now?

@andyleejordan andyleejordan changed the title Track cursor position when writing prompt Bring back WriteWithPrompt() Apr 28, 2022
@SeeminglyScience
Copy link
Collaborator Author

SeeminglyScience commented Apr 28, 2022

That work as "expected" now?

Yep it works. Would be interesting to see if we can revert this and find a way to not write the prompt when we don't need to as an option though. I like the idea. Probably for another time though

@andyleejordan andyleejordan enabled auto-merge (squash) April 28, 2022 19:52
@andyleejordan andyleejordan merged commit 459d717 into PowerShell:master Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants