[PR #12207] [MERGED] Introduce VTInt to represent VT parameters #28897

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12207
Author: @lhecker
Created: 1/20/2022
Status: ✅ Merged
Merged: 4/20/2022
Merged by: @undefined

Base: main ← Head: dev/lhecker/issue-4015-vt


📝 Commits (2)

  • 87263bb Introduce VTInt to represent VT parameters
  • 75a02fc Fix AuditMode errors

📊 Changes

36 files changed (+575 additions, -492 deletions)

View changed files

📝 src/cascadia/TerminalCore/ITerminalApi.hpp (+5 -5)
📝 src/cascadia/TerminalCore/Terminal.cpp (+1 -1)
📝 src/cascadia/TerminalCore/Terminal.hpp (+5 -5)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+23 -38)
📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+20 -32)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+12 -10)
📝 src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp (+9 -9)
📝 src/cascadia/UnitTests_TerminalCore/TerminalApiTest.cpp (+5 -5)
📝 src/host/outputStream.cpp (+3 -3)
📝 src/host/outputStream.hpp (+1 -1)
📝 src/host/ut_host/ScreenBufferTests.cpp (+4 -2)
📝 src/inc/til/point.h (+26 -2)
📝 src/inc/til/rect.h (+89 -4)
📝 src/inc/til/size.h (+13 -0)
📝 src/interactivity/win32/windowio.cpp (+1 -1)
📝 src/terminal/adapter/DispatchTypes.hpp (+42 -44)
📝 src/terminal/adapter/FontBuffer.cpp (+2 -2)
📝 src/terminal/adapter/FontBuffer.hpp (+2 -2)
📝 src/terminal/adapter/IInteractDispatch.hpp (+2 -2)
📝 src/terminal/adapter/ITermDispatch.hpp (+28 -28)

...and 16 more files

📄 Description

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.


🔄 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/12207 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 1/20/2022 **Status:** ✅ Merged **Merged:** 4/20/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/issue-4015-vt` --- ### 📝 Commits (2) - [`87263bb`](https://github.com/microsoft/terminal/commit/87263bbc64047c974caf9d463379b457f292c04f) Introduce VTInt to represent VT parameters - [`75a02fc`](https://github.com/microsoft/terminal/commit/75a02fcfe2c6b37fd8a95676166286f3b44a0327) Fix AuditMode errors ### 📊 Changes **36 files changed** (+575 additions, -492 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/ITerminalApi.hpp` (+5 -5) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+1 -1) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+5 -5) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+23 -38) 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+20 -32) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+12 -10) 📝 `src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp` (+9 -9) 📝 `src/cascadia/UnitTests_TerminalCore/TerminalApiTest.cpp` (+5 -5) 📝 `src/host/outputStream.cpp` (+3 -3) 📝 `src/host/outputStream.hpp` (+1 -1) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+4 -2) 📝 `src/inc/til/point.h` (+26 -2) 📝 `src/inc/til/rect.h` (+89 -4) 📝 `src/inc/til/size.h` (+13 -0) 📝 `src/interactivity/win32/windowio.cpp` (+1 -1) 📝 `src/terminal/adapter/DispatchTypes.hpp` (+42 -44) 📝 `src/terminal/adapter/FontBuffer.cpp` (+2 -2) 📝 `src/terminal/adapter/FontBuffer.hpp` (+2 -2) 📝 `src/terminal/adapter/IInteractDispatch.hpp` (+2 -2) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+28 -28) _...and 16 more files_ </details> ### 📄 Description 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. --- <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:31:30 +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#28897