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

AtlasEngine: Fix dirty rects during scrolling #17583

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Jul 18, 2024

This regressed in #15707. By having the viewportOffset on the
Settings object we accidentally invalidate the entire viewport
every time it scrolls. That doesn't break anything of course,
but it's better to prevent this.

This PR additionally contains a fix for clamping the y coordinates
coming from Renderer: Since viewportCellCount.y is a count and
thus exclusive, but clamp's max is inclusive, we must subtract 1.

@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Priority-3 A description (P3) Area-AtlasEngine labels Jul 18, 2024
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.

I don't get why a bunch of offsets are -1, but I think I understand why bumping the generation every time we scroll is bad?

@@ -325,7 +325,7 @@ CATCH_RETURN()

[[nodiscard]] HRESULT AtlasEngine::PrepareLineTransform(const LineRendition lineRendition, const til::CoordType targetRow, const til::CoordType viewportLeft) noexcept
{
const auto y = gsl::narrow_cast<u16>(clamp<til::CoordType>(targetRow, 0, _p.s->viewportCellCount.y));
const auto y = gsl::narrow_cast<u16>(clamp<til::CoordType>(targetRow, 0, _p.s->viewportCellCount.y - 1));
Copy link
Member

Choose a reason for hiding this comment

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

-1?

@DHowett
Copy link
Member

DHowett commented Jul 19, 2024

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@DHowett
Copy link
Member

DHowett commented Jul 19, 2024

Even so, it kicked off the build lol.

@DHowett
Copy link
Member

DHowett commented Jul 19, 2024

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

I concur about the -1 thing

@lhecker
Copy link
Member Author

lhecker commented Jul 22, 2024

I've updated the PR description to explain why the -1s where added. It's because clamp is used to ensure that the row offsets are valid, but I pass viewportCellCount.y as the maximum. Since clamp is inclusive the max, and a count is exclusive, they need a -1. (FWIW the row offsets should never be out of bounds in the first place and never have been to my knowledge. I'm just clamping them to be absolutely sure.)

@lhecker lhecker merged commit 0a2b660 into main Jul 22, 2024
21 of 22 checks passed
@lhecker lhecker deleted the dev/lhecker/atlas-engine-scroll-dirty branch July 22, 2024 12:48
lhecker added a commit that referenced this pull request Jul 26, 2024
Regressed in #15500, incorrectly fixed in #17332, exposed by #17583.
My ineptitude on full display. If this isn't the last cursor
invalidation bug I'm going to cry.

Closes #17615

## Validation Steps Performed
* cmd.exe
* a directory with 6 files
* 80x24 viewport
* run `cls`
* run `dir` twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AtlasEngine Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants