[PR #4493] [CLOSED] Implement til::au16 and til::u16a conversion functions & make first use in WriteConsoleAImpl #25784

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4493
Author: @german-one
Created: 2/6/2020
Status: Closed

Base: masterHead: master


📝 Commits (10+)

  • a8bd2df implement til::au16 and til::u16a conversion functions & update related code
  • b19b066 eliminate redundant code, update comments, rearrange functions
  • 37324d5 add unit test for DBCS partials
  • fcc9bf1 make first use in WriteConsoleAImpl
  • 2571d23 pass static analysis
  • c7bdc90 try harder to pass the SA
  • 7f77579 have fun with C array
  • c07cb48 get over the brace barrier?
  • 20f1d2b see what til::at makes out of it
  • aff87e0 try again to suppress warnings

📊 Changes

9 files changed (+580 additions, -165 deletions)

View changed files

📝 .github/actions/spell-check/whitelist/whitelist.txt (+2 -0)
📝 src/cascadia/TerminalConnection/ConptyConnection.h (+1 -1)
📝 src/host/VtInputThread.hpp (+1 -1)
📝 src/host/_stream.cpp (+5 -81)
📝 src/host/screenInfo.cpp (+1 -2)
📝 src/host/screenInfo.hpp (+2 -2)
📝 src/inc/til/at.h (+40 -11)
📝 src/inc/til/u8u16convert.h (+403 -65)
📝 src/til/ut_til/u8u16convertTests.cpp (+125 -2)

📄 Description

Summary of the Pull Request

Implement conversion functions that complement the existing til::u8u16 and til::u16u8 for the use along with other codepages than UTF-8. A state class will take care of partials at the boundaries of DBCS-encoded text.

References

Proposed in https://github.com/microsoft/terminal/pull/4422#discussion_r374364170

PR Checklist

  • Closes #xxx
  • 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: #xxx

Detailed Description of the Pull Request / Additional comments

These functions have the potential to supersede ConvertToW and ConvertToA by adding partials handling.
NOTE: The astate class supports only a subset of the possible codepages (see the remarks in the code).

In order to see how it works I updated WriteConsoleAImpl accordingly.
I plan to search the code base for more points to apply these functions to, and commit those updates in an upcoming PR.

Validation Steps Performed

  • long DBCS strings split into short chunks with an odd number of bytes, and outputted to the console using WriteConsoleA
  • unit test added

🔄 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/4493 **Author:** [@german-one](https://github.com/german-one) **Created:** 2/6/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`a8bd2df`](https://github.com/microsoft/terminal/commit/a8bd2df9f4d488f4427ea487f2f1d19e51388d12) implement til::au16 and til::u16a conversion functions & update related code - [`b19b066`](https://github.com/microsoft/terminal/commit/b19b0660aaa798dec3399408db1f0b236140dd79) eliminate redundant code, update comments, rearrange functions - [`37324d5`](https://github.com/microsoft/terminal/commit/37324d5bc23a09139a3912c7659f8b9773abacae) add unit test for DBCS partials - [`fcc9bf1`](https://github.com/microsoft/terminal/commit/fcc9bf1ec2696019b94dfa66bda439ac8e1fe970) make first use in `WriteConsoleAImpl` - [`2571d23`](https://github.com/microsoft/terminal/commit/2571d23a58c1fdb6551386f56b58c0b32f20e3de) pass static analysis - [`c7bdc90`](https://github.com/microsoft/terminal/commit/c7bdc90cb791c5e48578520a831c12798a45612a) try harder to pass the SA - [`7f77579`](https://github.com/microsoft/terminal/commit/7f7757991169bf7fc6ac1410c50e79a93cf7bd57) have fun with C array - [`c07cb48`](https://github.com/microsoft/terminal/commit/c07cb48393c6ee90183c0a2e3b793130f50e544b) get over the brace barrier? - [`20f1d2b`](https://github.com/microsoft/terminal/commit/20f1d2b28cf24129029f60b4e4396832e271f80a) see what til::at makes out of it - [`aff87e0`](https://github.com/microsoft/terminal/commit/aff87e0e2af93f1b2677747aa8ddbfce2b69c087) try again to suppress warnings ### 📊 Changes **9 files changed** (+580 additions, -165 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spell-check/whitelist/whitelist.txt` (+2 -0) 📝 `src/cascadia/TerminalConnection/ConptyConnection.h` (+1 -1) 📝 `src/host/VtInputThread.hpp` (+1 -1) 📝 `src/host/_stream.cpp` (+5 -81) 📝 `src/host/screenInfo.cpp` (+1 -2) 📝 `src/host/screenInfo.hpp` (+2 -2) 📝 `src/inc/til/at.h` (+40 -11) 📝 `src/inc/til/u8u16convert.h` (+403 -65) 📝 `src/til/ut_til/u8u16convertTests.cpp` (+125 -2) </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 Implement conversion functions that complement the existing `til::u8u16` and `til::u16u8` for the use along with other codepages than UTF-8. A state class will take care of partials at the boundaries of DBCS-encoded text. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References Proposed in https://github.com/microsoft/terminal/pull/4422#discussion_r374364170 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [ ] Closes #xxx * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] 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: #xxx <!-- 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 These functions have the potential to supersede `ConvertToW` and `ConvertToA` by adding partials handling. NOTE: The `astate` class supports only a subset of the possible codepages (see the remarks in the code). In order to see how it works I updated `WriteConsoleAImpl` accordingly. I plan to search the code base for more points to apply these functions to, and commit those updates in an upcoming PR. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - long DBCS strings split into short chunks with an odd number of bytes, and outputted to the console using `WriteConsoleA` - unit test added --- <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:11:46 +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#25784