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 invalidation when the cursor is invisible #15904

Merged

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 30, 2023

PaintCursor() is only called when the cursor is visible, but we need
to invalidate the cursor area even if it isn't. Otherwise a transition
from a visible to an invisible cursor wouldn't be rendered.

I'm confident that this closes #15199

Validation Steps Performed

  • Set blink duration extremely high
  • Launch pwsh.exe
  • Press Enter a few times
  • Press Ctrl+L
  • There are never 2 cursors visible, not even briefly ✅

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-AtlasEngine Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Product-Terminal The new Windows Terminal. labels Aug 30, 2023
@@ -251,6 +251,16 @@ try
{
_flushBufferLine();

// PaintCursor() is only called when the cursor is visible, but we need to invalidate the cursor area
// even if it isn't. Otherwise a transition from a visible to an invisible cursor wouldn't be rendered.
Copy link
Member Author

@lhecker lhecker Aug 30, 2023

Choose a reason for hiding this comment

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

The confusing part here (at least for me) and what led to this bug, is that there's a distinction in our code between a visible cursor and a cursor that's "on". !IsCursorVisible() forces the cursor to not be drawn, but it can still be on/off when it blinks while being invisible.
...and while it blinks it still gets invalidated (why tho?).

BTW there's also IsConversionArea() which is supposed to be an invisibility flag, but it must've gotten broken at some point in conhost's rewrite to C++ so now it is visible (whoops) but unlike !IsCursorVisible() it doesn't invalidate the area being drawn, so it just happens to work (unless you invalidate the cursor).
As mentioned yesterday, the cursor code is not in a great shape right now. 🥲

@lhecker lhecker changed the title AtlasEngine Fix invalidation when the cursor is invisible AtlasEngine: Fix invalidation when the cursor is invisible Aug 30, 2023
@lhecker lhecker added the AutoMerge Marked for automatic merge by the bot when requirements are met label Sep 5, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot deleted the dev/lhecker/atlasengine-fixup branch September 5, 2023 11:14
DHowett pushed a commit that referenced this pull request Sep 22, 2023
`PaintCursor()` is only called when the cursor is visible, but we need
to invalidate the cursor area even if it isn't. Otherwise a transition
from a visible to an invisible cursor wouldn't be rendered.

I'm confident that this closes #15199

## Validation Steps Performed
* Set blink duration extremely high
* Launch pwsh.exe
* Press Enter a few times
* Press Ctrl+L
* There are never 2 cursors visible, not even briefly ✅

(cherry picked from commit 60843fa)
Service-Card-Id: 90438488
Service-Version: 1.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AtlasEngine Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues 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. Product-Terminal The new Windows Terminal.
Projects
Development

Successfully merging this pull request may close these issues.

Graphical glitches when using hardware rendering
3 participants