CLI: Add VT Support library and update tests/callbacks to use it#40710
Open
dkbennett wants to merge 12 commits into
Open
CLI: Add VT Support library and update tests/callbacks to use it#40710dkbennett wants to merge 12 commits into
dkbennett wants to merge 12 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a shared VT (virtual terminal) support library under src/windows/common to centralize VT sequence constants/construction and console-mode RAII helpers, then updates WSLC callbacks and tests to consume the shared implementation (removing the prior WSLC-local ChangeTerminalMode.h).
Changes:
- Added
wsl::windows::common::vtVT sequence helpers, stream/concat operators, and console-mode RAII helpers (VTSupport.h/.cpp) and wired them into the common build. - Migrated WSLC image progress/build callbacks away from WSLC-local VT definitions to the shared VT support.
- Updated WSLC E2E helpers and added a new unit test suite validating VT sequences and console-mode helpers.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/WSLCCLIVTSupportUnitTests.cpp | Adds new unit tests covering VT sequences and console-mode RAII helpers. |
| test/windows/wslc/e2e/WSLCExecutor.h | Adds Sequence overloads for stdout/stderr expectations in interactive sessions. |
| test/windows/wslc/e2e/WSLCExecutor.cpp | Adjusts formatting/expectations to use Sequence-based constants. |
| test/windows/wslc/e2e/WSLCE2EHelpers.h | Replaces ad-hoc VT macros with shared VTSupport sequences and helpers. |
| src/windows/wslc/services/ImageProgressCallback.h | Switches includes and member types to wsl::windows::common::vt helpers. |
| src/windows/wslc/services/ImageProgressCallback.cpp | Uses shared cursor-movement sequences instead of raw escape literals. |
| src/windows/wslc/services/ChangeTerminalMode.h | Removes WSLC-local cursor/VT RAII helpers (superseded by common VTSupport). |
| src/windows/wslc/services/BuildImageCallback.h | Switches to shared VT enablement helper; minor type adjustments for line counts. |
| src/windows/wslc/services/BuildImageCallback.cpp | Replaces raw escape formatting with shared VT sequences and stream composition. |
| src/windows/common/VTSupport.h | Adds new public VT support API (sequences, operators, and RAII helpers). |
| src/windows/common/VTSupport.cpp | Implements VT constants/builders and DA1 parsing. |
| src/windows/common/CMakeLists.txt | Adds VTSupport sources/headers to the windows/common build. |
Comment on lines
26
to
31
| public: | ||
| auto MoveToLine(SHORT line); | ||
| auto MoveToLine(int line); | ||
| HRESULT OnProgress(LPCSTR status, LPCSTR id, ULONGLONG current, ULONGLONG total) override; | ||
|
|
||
| private: | ||
| static CONSOLE_SCREEN_BUFFER_INFO Info(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This is a foundational addition of VT support classes, wrappers, and constants to make working with VT sequences consistent and simpler without having to deal with the actual sequences and restoration. It removes the old ChangeTerminalMode.h and rolls that into the new VTSupport.h and cpp. This is added under windows/common so it can be utilized by more than just the CLI, but the unit tests are in with the CLI.
This should also help alleviate some other pulls where VT sequences are being defined in multiple locations, and also serves as a foundation for enhanced VT support in the CLI.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed