[PR #1709] [MERGED] Enable DECCOLM support via a private mode escape sequence #24649

Open
opened 2026-01-31 09:04:34 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/1709
Author: @j4james
Created: 6/29/2019
Status: Merged
Merged: 7/2/2019
Merged by: @miniksa

Base: masterHead: feature-mode-40


📝 Commits (3)

  • d6f29f0 Implement XTerm's private mode escape sequence for enabling DECCOLM support.
  • b5dfbd6 Add output engine and screen buffer units test for the private mode 40 escape sequence.
  • 77bf97d Update formatting to pass the code formatting check.

📊 Changes

7 files changed (+188 additions, -9 deletions)

View changed files

📝 src/host/ut_host/ScreenBufferTests.cpp (+132 -0)
📝 src/terminal/adapter/DispatchTypes.hpp (+1 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+1 -0)
📝 src/terminal/adapter/adaptDispatch.cpp (+22 -8)
📝 src/terminal/adapter/adaptDispatch.hpp (+2 -1)
📝 src/terminal/adapter/termDispatch.hpp (+1 -0)
📝 src/terminal/parser/ut_parser/OutputEngineTest.cpp (+29 -0)

📄 Description

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

  • Closes Screen Buffer Size and overscrolling (#171)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #171

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 in SetColumns, 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 a EnableDECCOLMSupport 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/1709 **Author:** [@j4james](https://github.com/j4james) **Created:** 6/29/2019 **Status:** ✅ Merged **Merged:** 7/2/2019 **Merged by:** [@miniksa](https://github.com/miniksa) **Base:** `master` ← **Head:** `feature-mode-40` --- ### 📝 Commits (3) - [`d6f29f0`](https://github.com/microsoft/terminal/commit/d6f29f05c9fd3f58ef9ae2aaa0f1038c2d7d8139) Implement XTerm's private mode escape sequence for enabling DECCOLM support. - [`b5dfbd6`](https://github.com/microsoft/terminal/commit/b5dfbd6ff97b2744e721c95d37123202de93a167) Add output engine and screen buffer units test for the private mode 40 escape sequence. - [`77bf97d`](https://github.com/microsoft/terminal/commit/77bf97d3a254423f42b05170c5245c5c681f0eb5) Update formatting to pass the code formatting check. ### 📊 Changes **7 files changed** (+188 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+132 -0) 📝 `src/terminal/adapter/DispatchTypes.hpp` (+1 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+1 -0) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+22 -8) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+2 -1) 📝 `src/terminal/adapter/termDispatch.hpp` (+1 -0) 📝 `src/terminal/parser/ut_parser/OutputEngineTest.cpp` (+29 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request While the [DECCOLM](https://vt100.net/docs/vt100-ug/chapter3.html#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](https://invisible-island.net/vttest/), and with unit tests. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #171 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [x] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #171 <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## 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 in `SetColumns`, 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 a `EnableDECCOLMSupport` 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. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## 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](https://invisible-island.net/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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:04:34 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24649