Repository navigation
Merge the LineFeed functionality into AdaptDispatch - #14874
Conversation
|
I didn't notice in the PR description that margins also moved into AdaptDispatch! Very clever, I love the new better encapsulation. |
| // We trigger a scroll rather than a redraw, since that's more efficient, | ||
| // but we need to turn the cursor off before doing so, otherwise a ghost | ||
| // cursor can be left behind in the previous position. | ||
| cursor.SetIsOn(false); |
There was a problem hiding this comment.
qq: who turns it back on?
There was a problem hiding this comment.
There's a call to _ApplyCursorMovementFlags at the end of the method which turns the cursor back on.
Dustin L. Howett (DHowett)
left a comment
There was a problem hiding this comment.
It all makes sense to me! I'd love to get Mike Griese (@zadjii-msft)'s or Leonard Hecker (@lhecker)'s hands on the ball as well.
Thanks for being so patient with us, James Holderness (@j4james)!
Mike Griese (zadjii-msft)
left a comment
There was a problem hiding this comment.
Thank you for remedying the abomination that was AdjustCursorPosition - that got wildly out of hand during windows 10 and I absolutely hated every minute of it. This seems a lot easier to parse.
The main purpose of this PR was to merge the
ITerminalApi::LineFeedimplementations into a shared method in
AdaptDispatch, and avoid theVT code path depending on the
AdjustCursorPositionfunction (whichcould then be massively simplified). This refactoring also fixes some
bugs that existed in the original
LineFeedimplementations.References and Relevant Issues
This helps to close the gap between the Conhost and Terminal (#13408).
This improves some of the scrollbar mark bugs mentioned in #11000.
Detailed Description of the Pull Request / Additional comments
I had initially hoped the line feed functionality could be implemented
entirely within
AdaptDispatch, but there is still some Conhost andTerminal-specific behavior that needs to be triggered when we reach the
bottom of the buffer, and the row coordinates are cycled.
In Conhost we need to trigger an accessibility scroll event, and in
Windows Terminal we need to update selection and marker offsets, reset
pattern intervals, and preserve the user's scroll offset. This is now
handled by a new
NotifyBufferRotationmethod inITerminalApi.But this made me realise that the
_EraseAllmethod should have beendoing the same thing when it reached the bottom of the buffer. So I've
added a call to the new
NotifyBufferRotationAPI from there as well.And in the case of Windows Terminal, the scroll offset preservation was
something that was also needed for a regular viewport pan. So I've put
that in a separate
_PreserveUserScrollOffsetmethod which is calledfrom the
SetViewportPositionhandler as well.Validation Steps Performed
Because of the API changes, there were a number of unit tests that
needed to be updated:
Some of the
ScreenBufferTestswere accessing margin state in theSCREEN_INFORMATIONclass which doesn't exist anymore, so I had to adda little helper function which now manually detects the active margins.
Some of the
AdapterTesttests were dependent on APIs that no longerexist, so they needed to be rewritten so they now check the resulting
state rather than expecting a mock API call.
The
ScrollWithMarginstest inConptyRoundtripTestswas testingfunctionality that didn't previously work correctly (issue Scrolling within regions that include the top of the screen doesn't push lines into scrollback #3673). Now
that it's been fixed, that test needed to be updated accordingly.
Other than getting the unit tests working, I've manually verified that
issue #3673 is now fixed. And I've also checked that the scroll markers,
selections, and user scroll offset are all being updated correctly, both
with a regular viewport pan, as well as when overrunning the buffer.
Closes #3673