-
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
Prevent the VT engine painting unnecessarily #17194
Conversation
if (_usingLineRenditions && !_quickReturn) | ||
// when we're writing out a single character, which should preclude there | ||
// being a rendition switch. | ||
if (_usingLineRenditions && !_invalidMap.one()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if .one()
returns true for a single invalid wide char, but on the other hand... meh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was very much a "meh" solution, even more so when it was using quickReturn
. I just wanted something that was easy to test, and not risk false positives by overcomplicating it. Most people will never be impacted by this anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both concise and an improvement. Thanks!
When the VT render engine starts a paint operation, it first checks to see whether there is actually something to do, and if not it can end the frame early. However, the result of that check was being ignored, which could sometimes result in an unwanted `SGR` reset being written to the conpty pipe. This was particular concerning when passing through `DCS` sequences, because an unexpected `SGR` in the middle of the `DCS` string would cause it to abort early. This PR addresses the problem by making sure the `VtEngine::StartPaint` return value is appropriately handled in the `XtermEngine` class. ## Detailed Description of the Pull Request / Additional comments To make this work, I also needed to correct the `_cursorMoved` flag, because that is one of things that determines whether a paint is needed or not, but it was being set in the `InvalidateCursor` method at the start of ever frame, regardless of whether the cursor had actually moved. I also took this opportunity to get rid of the `_WillWriteSingleChar` method and the `_quickReturn` flag, which have been mostly obsolete for a long time now. The only place the flag was still used was to optimize single char writes when line renditions are active. But that could more easily be handled by testing the `_invalidMap` directly. ## Validation Steps Performed I've confirmed that the test case in issue #17117 is no longer aborting the `DCS` color table sequence early. Closes #17117 (cherry picked from commit 432dfcc) Service-Card-Id: 92501130 Service-Version: 1.21
When the VT render engine checks whether the cursor has moved in the `InvalidateCursor` method, it does so by comparing the origin of the given cursor region with the last text output coordinates. But these two values are actually from different coordinate systems, and when on a double-width line, the x text coordinate is half of the corresponding screen coordinate. As a result, the movement detection is sometimes incorrect. This PR fixes the issue by adding another field to track the last cursor origin in screen coordinates, so we have a meaningful value to compare against. ## References and Relevant Issues The previous cursor movement detection was added in PR #17194 to fix issue #17117. ## Validation Steps Performed I've confirmed that the test case from issue #17232 is now fixed, and the test case from issue #17117 is still working as expected. ## PR Checklist - [x] Closes #17232
When the VT render engine starts a paint operation, it first checks to
see whether there is actually something to do, and if not it can end the
frame early. However, the result of that check was being ignored, which
could sometimes result in an unwanted
SGR
reset being written to theconpty pipe.
This was particular concerning when passing through
DCS
sequences,because an unexpected
SGR
in the middle of theDCS
string wouldcause it to abort early.
This PR addresses the problem by making sure the
VtEngine::StartPaint
return value is appropriately handled in the
XtermEngine
class.Detailed Description of the Pull Request / Additional comments
To make this work, I also needed to correct the
_cursorMoved
flag,because that is one of things that determines whether a paint is needed
or not, but it was being set in the
InvalidateCursor
method at thestart of ever frame, regardless of whether the cursor had actually
moved.
I also took this opportunity to get rid of the
_WillWriteSingleChar
method and the
_quickReturn
flag, which have been mostly obsolete fora long time now. The only place the flag was still used was to optimize
single char writes when line renditions are active. But that could more
easily be handled by testing the
_invalidMap
directly.Validation Steps Performed
I've confirmed that the test case in issue #17117 is no longer aborting
the
DCS
color table sequence early.Closes #17117