Enable DECCOLM support via a private mode escape sequence #1709
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
While the DECCOLM escape sequence is technically implemented, it's disabled by a flag that is not user-accessible. This PR adds support for an escape sequence (XTerm's private mode 40) which essentially enables that flag, so users can turn on DECCOLM support in an XTerm-compatible way. Tested manually, with Vttest, and with unit tests.
PR Checklist
Detailed Description of the Pull Request / Additional comments
My initial plan was to build this on top of the existing
_fIsSetColumnsEnabled
flag, but after further investigation that proved not to be practical. In order to be compatible with XTerm, the flag needs to be checked in the_DoDECCOLMHelper
method rather than inSetColumns
, since it needs to prevent all facets of the DECCOLM operation taking effect - not just the column sizing.And in the future, if the
SetColumns
method is also going to be used to support the DECSCPP escape sequence, that will need a flag of its own - it's not controlled by the same option as DECCOLMN.For those reasons, I've removed the existing
_fIsSetColumnsEnabled
flag and added a new_fIsDECCOLMAllowed
flag which is checked in the_DoDECCOLMHelper
method. I've then added aEnableDECCOLMSupport
method to toggle that flag, and added a case in_PrivateModeParamsHelper
to call that method in response to the private mode 40 sequence.While I did mention my initial plans on issue #171, I never actually got feedback from core contributors, so I completely understand if this PR is rejected in favour of a different approach. I'm just offering it as one possible solution.
Validation Steps Performed
I've added an output engine unit test which validates that the private mode escape sequences trigger the
EnableDECCOLMSupport
call, and some screen buffer unit tests which check that the DECCOLM sequence does take effect when allowed, and doesn't do anything when disallowed.I've also done a fair amount of manual testing, and run several of the Vttest suites which toggle between 80 and 132 column modes, and which now work (at least in terms of column width) where previously they didn't.