[PR #12207] Introduce VTInt to represent VT parameters #28902

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

Original Pull Request: https://github.com/microsoft/terminal/pull/12207

State: closed
Merged: Yes


This commit replaces our use of size_t to represent VT parameters with
int32_t. While unsigned integers have the inherent benefit of being less
ambiguous and enjoying two's complement, our buffer coordinates use signed
integers. Since a number of VT functions need to convert their parameters
to coordinates, this commit makes the conversion easier.
The benefit of this change becomes even more apparent if one considers
that a number of places performed unsafe conversions
of their size_t parameters to int or short already.

Files that had to be modified were converted to use til
wrappers instead of COORD or SMALL_RECT wherever possible.

References

This commit contains about 20% of the work for #4015.

PR Checklist

  • I work here
  • Tests added/passed

Validation Steps Performed

I'm mostly relying on our unit tests here. Both OpenConsole and WT appear to work fine.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/12207 **State:** closed **Merged:** Yes --- This commit replaces our use of `size_t` to represent VT parameters with `int32_t`. While unsigned integers have the inherent benefit of being less ambiguous and enjoying two's complement, our buffer coordinates use signed integers. Since a number of VT functions need to convert their parameters to coordinates, this commit makes the conversion easier. The benefit of this change becomes even more apparent if one considers that a number of places performed unsafe conversions of their size_t parameters to int or short already. Files that had to be modified were converted to use til wrappers instead of COORD or SMALL_RECT wherever possible. ## References This commit contains about 20% of the work for #4015. ## PR Checklist * [x] I work here * [x] Tests added/passed ## Validation Steps Performed I'm mostly relying on our unit tests here. Both OpenConsole and WT appear to work fine.
claunia added the pull-request label 2026-01-31 09:31:31 +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#28902