-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Reimplement the VT tab stop functionality #5173
Conversation
…N class and the ConGetSet interface.
…art of every screen buffer test.
…top functionality removed from the ConGetSet interface.
209bbce
to
7354777
Compare
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.
Class act as always. Thank you, @j4james
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.
So wait, just to be clear, the main and alt buffer are supposed to share one set of tab stops?
Yep. There's a test case in #3545 which demonstrates this issue and a screenshot of the XTerm behaviour. VTE and Mintty work the same way. |
…nts for the new private methods.
Note that build failure is just a timeout in the unit tests. The second last commit was fine, and the one that followed was just a comment fix, so no reason it should make any difference. |
Kicked the failed test. |
The two Mikes, who would otherwise be reviewing and/or signing off, aren't available today -- this might take a little bit to get merged, but I'll tag it for Auto and Second. |
Hello @DHowett-MSFT! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@msftbot make sure @zadjii-msft signs off |
Hello @DHowett-MSFT! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
That's cool. I wasn't expecting you'd even look at it before the v1 release. I'm not in any rush to get anything merged. |
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.
Thanks for clarifying!
🎉 Handy links: |
Summary of the Pull Request
This is essentially a rewrite of the VT tab stop functionality, implemented entirely within the
AdaptDispatch
class. This significantly simplifies theConGetSet
interface, and should hopefully make it easier to share the functionality with the Windows Terminal VT implementation in the future.By removing the dependence on the
SCREEN_INFORMATION
class, it fixes the problem of the the tab state not being preserved when switching between the main and alternate buffers. And the new architecture also fixes problems with the tabs not being correctly initialized when the screen is resized.References
This fixes one aspect of issue #3545.
It also supersedes the fix for #411 (PR #2816).
I'm hoping the simplification of
ConGetSet
will help with #3849.PR Checklist
Detailed Description of the Pull Request / Additional comments
In the new tab architecture, there is now a
vector<bool>
(_tabStopColumns), which tracks whether any particular column is a tab stop or not. There is also a _initDefaultTabStops flag indicating whether the default tab stop positions need to be initialised when the screen is resized.The way this works, the vector is initially empty, and only initialized (to the current width of the screen) when it needs to be used. When the vector grows in size, the _initDefaultTabStops flag determines whether the new columns are set to false, or if every 8th column is set to true.
By default we want the latter behaviour - newly revealed columns should have default tab stops assigned to them - so _initDefaultTabStops is set to true. However, after a
TBC 3
operation (i.e. we've cleared all tab stops), there should be no tab stops in any newly revealed columns, so _initDefaultTabStops is set to false.Note that the _tabStopColumns vector is never made smaller when the window is shrunk, and that way it can preserve the state of tab stops that are off screen, but which may come into range if the window is made bigger again.
However, we can can still reset the vector completely after an
RIS
orTBC 3
operation, since the state can then be reconstructed automatically based on just the _initDefaultTabStops flag.Validation Steps Performed
The original screen buffer tests had to be rewritten to set and query the tab stop state using escape sequences rather than interacting with the
SCREEN_INFORMATION
class directly, but otherwise the structure of most tests remained largely the same.However, the alt buffer test was significantly rewritten, since the original behaviour was incorrect, and the initialization test was dropped completely, since it was no longer applicable. The adapter tests were also dropped, since they were testing the
ConGetSet
interface which has now been removed.I also had to make an addition to the method setup of the screen buffer tests (making sure the viewport was appropriately initialized), since there were some tests (unrelated to tab stops) that were previously dependent on the state being set in the tab initialization test which has now been removed.
I've manually tested the issue described in #4669 and confirmed that the tabs now produce the correct spacing after a resize.