-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Issues with cursor invalidation in GDI #17150
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Open similar issues:
Closed similar issues:
|
I love you github-actions bot, and I hope you'll spare my life when the robot revolution comes, but I feel a little bit hurt when you suggest a bunch of my own issues back to me, like idiot human can't remember that he's already raised this issue before. Although to be fair, that's not an unreasonable assumption. |
As to how we fix this issue, I can get it to work again by replicating most of the following code a couple of lines down: terminal/src/renderer/base/renderer.cpp Lines 124 to 160 in 378b659
That is, after we've reinitialized |
There were multiple bugs: * GDI engine only paints whatever has been invalidated. This means we need to not just invalidate the old cursor rect but also the new one, or else movements may not be visible. * The composition should be drawn at the cursor position even if the cursor is invisible, but inside the renderer viewport. * Conceptually, scrolling the viewport moves the relative cursor position even if the cursor is invisible. * An invisible cursor is not the same as one that's outside the viewport. It's more like a cursor that's not turned on. To resolve the first issue we simply need to call `InvalidateCursor` again. To do so, it was abstracted into `_invalidateCurrentCursor()`. The next 2 issues are resolved by un-`optional`-izing `CursorOptions`. After all, even an invisible or an out-of-bounds cursor still has a coordinate and it may still be scrolled into view. Instead, it has the new `inViewport` property as a replacement. This allows for instance the IME composition code in the renderer to use the cursor coordinate while the cursor is invisible. The last issue is fixed by simply changing the `.isOn` logic. Closes #17150 ## Validation Steps Performed * In conhost with the GDI renderer: `printf "\e[2 q"; sleep 2; printf "\e[A"; sleep 2; printf "\e[B"` Cursor moves up after 2s and then down again after 2s. ✅ * Hide the cursor (`"\e[?25l"`) and use a CJK IME. Words can still be written and deleted correctly. ✅ * Turning the cursor back on (`"\e[?25h"`) works ✅ * Scrolling shows/hides the cursor ✅
Windows Terminal version
Commit 378b659
Windows build number
10.0.19045.4291
Other Software
No response
Steps to reproduce
UseDx
registry entry is 0).Expected Behavior
The above script is setting the cursor to a steady block so it's easy to see, sleeping for 2 seconds, moving up a line and sleeping for another 2 seconds, then moving the cursor back down again. You should be able to see the cursor the entire time.
Actual Behavior
Initially the cursor is visible, but as soon as we move up a line it becomes invisible for 2 seconds.
I believe this is a regression from PR #15500. Originally we would call
InvalidateCursor
(viaTriggerRedrawCursor
) whenever the cursor was moved, both to invalidate the old position and the new position. But since PR #15500,TriggerRedrawCursor
has been nuked, andInvalidateCursor
is now called at the start of every frame (regardless of whether the cursor is moved or not), and it only invalidates the old cursor position. So when the cursor moves, it's erased from the old position, but not redrawn in the new position.This typically only affects vertical movement (other than some edge cases), because at some point I think we stopped caring about the horizontal extent of the invalidated region and just refresh the full width of the screen regardless. This also doesn't seem to affect the DX and Atlas engines, but I have no idea why.
The text was updated successfully, but these errors were encountered: