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

Make sure the virtual viewport doesn't go negative #13052

Merged
2 commits merged into from May 9, 2022

Conversation

j4james
Copy link
Collaborator

@j4james j4james commented May 6, 2022

Summary of the Pull Request

When calculating the position of the virtual bottom after a resize with
reflow, it was possible for it to end up less than the height of the
viewport. This meant that the top of the virtual viewport would be
negative, which resulted in other operations failing further down the
line. This PR updates the virtual bottom calculation to fix that
scenario.

References

This was probably a regression introduced in PR #12972.

PR Checklist

Validation Steps Performed

I wasn't able to replicate the exact case described in issue #13034,
because I don't have Windows 11, so can't configure the default
terminal. However, I was able to reproduce a similar failure using a
SetConsoleScreenBufferInfoEx call, and I've confirmed that this PR
has fixed that.

I've also added another screen buffer test to make sure the
ResizeWithReflow method doesn't shrink the virtual bottom when
resizing at the top of the buffer.

@ghost ghost added Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Conhost For issues in the Console codebase Severity-Blocking We won't ship a release like this! No-siree. labels May 6, 2022
@DHowett
Copy link
Member

DHowett commented May 9, 2022

I'll run a quick test build with this fix :)

Thanks for jumping on it!

@DHowett DHowett added this to To Cherry Pick in 1.14 Servicing Pipeline via automation May 9, 2022
@DHowett
Copy link
Member

DHowett commented May 9, 2022

@msftbot merge this in 5 minutes

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label May 9, 2022
@ghost
Copy link

ghost commented May 9, 2022

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Mon, 09 May 2022 19:55:35 GMT, which is in 5 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works beautifully. Thanks!

@ghost ghost merged commit ec726e7 into microsoft:main May 9, 2022
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.14 Servicing Pipeline May 10, 2022
@j4james j4james deleted the fix-virtual-viewport branch May 14, 2022 12:45
@ghost
Copy link

ghost commented May 24, 2022

🎉Windows Terminal Preview v1.14.143 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Conhost For issues in the Console codebase Severity-Blocking We won't ship a release like this! No-siree.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

There may be a bug in unreleased code that throws a PSReadLine exception under certain conditions
3 participants