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

Restore contents when a screen info is closed #17853

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Sep 3, 2024

This moves the SetConsoleActiveScreenBufferImpl into VtIo which
allows us to use the code when the screen info handle is closed.

Closes #17817

Validation Steps Performed

  • Calling CreateConsoleScreenBuffer + SetConsoleActiveScreenBuffer
    • CloseHandle results in no obvious screen changes ✅

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-VT Virtual Terminal sequence support Product-Conpty For console issues specifically related to conpty labels Sep 3, 2024
Comment on lines +804 to +813
if (oldSize != main.GetBufferSize().Dimensions())
{
THROW_IF_NTSTATUS_FAILED(main.ResizeTraditional(oldSize));
main.SetViewportSize(&oldSize);
}
if (hasAltBuffer && oldSize != alt.GetBufferSize().Dimensions())
{
THROW_IF_NTSTATUS_FAILED(alt.ResizeTraditional(oldSize));
alt.SetViewportSize(&oldSize);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These two blocks have changed slightly, to avoid reflow when the size hasn't changed (the common case I assume). All other code remains unchanged.

@DHowett DHowett merged commit 4eb06fe into main Sep 6, 2024
20 checks passed
@DHowett DHowett deleted the dev/lhecker/17817-screen-info-close branch September 6, 2024 15:18
DHowett pushed a commit that referenced this pull request Sep 6, 2024
(cherry picked from commit 4eb06fe)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSaylY
Service-Version: 1.22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conpty For console issues specifically related to conpty
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Original console buffer is not restored when closing a secondary one
3 participants