[PR #4850] [MERGED] til::size #25982

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4850
Author: @miniksa
Created: 3/9/2020
Status: Merged
Merged: 3/10/2020
Merged by: @undefined

Base: masterHead: dev/miniksa/til_size


📝 Commits (10+)

  • cecf553 Submit initial proposal for til::size including tests.
  • abd0056 code format run.
  • 016be0a add comment for why int cast one is blocked out
  • a34a855 Fix error in test logic for x86 environments.
  • 952d92a SA pass.
  • e05d830 Use multiplication to see if there was a remainder instead of modulo since we already did division (for perf reasons, per PR.)
  • 9192d9c Revert OpenConsole.sln
  • b9da020 Add a natvis for til::size
  • c063e3e Merge branch 'dev/miniksa/til_size' of https://github.com/microsoft/terminal into dev/miniksa/til_size
  • bd10986 Merge branch 'master' into dev/miniksa/til_size

📊 Changes

8 files changed (+791 additions, -2 deletions)

View changed files

📝 src/inc/til.h (+1 -0)
src/inc/til/size.h (+265 -0)
📝 src/til/precomp.h (+10 -0)
src/til/ut_til/SizeTests.cpp (+494 -0)
📝 src/til/ut_til/SomeTests.cpp (+0 -1)
📝 src/til/ut_til/til.unit.tests.vcxproj (+1 -0)
src/til/ut_til/til.unit.tests.vcxproj.filters (+15 -0)
📝 tools/ConsoleTypes.natvis (+5 -1)

📄 Description

Summary of the Pull Request

Introduces convenience type til::size which automatically implements our best practices for size-related types and provides automatic conversions in/out of the relevant types.

PR Checklist

  • In support of Differental Rendering #778
  • I work here.
  • Tests added/passed
  • I'm a core contributor.

Detailed Description of the Pull Request / Additional comments

  • Automatically converts in from anything with a X/Y (console COORD) or cx/cy (Win32 SIZE)
  • Automatically converts out to COORD, SIZE, or D2D1_SIZE_F.
  • Constructs from bare integers written into source file
  • Default constructs to empty
  • Uses Chromium Math for all basic math operations (+, -, *, /)
  • Provides equality tests
  • Adds initial proposal for division-to-ceiling (round up division) that attempts to ceil without any floating point math.
  • Accessors for height/width
  • Type converting accessors (that use safe conversions and throw) for height/width
  • Convenience function for area calculation (as that's common with type) and uses safe math to do it.
  • TAEF/WEX Output and Comparators so they will print very nicely with VERIFY and Log macros in our testing suite.

Validation Steps Performed

  • See automated tests of functionality.

🔄 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/4850 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 3/9/2020 **Status:** ✅ Merged **Merged:** 3/10/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/miniksa/til_size` --- ### 📝 Commits (10+) - [`cecf553`](https://github.com/microsoft/terminal/commit/cecf553a85aba6657ec29d1b3ede3ecfd1c717ef) Submit initial proposal for til::size including tests. - [`abd0056`](https://github.com/microsoft/terminal/commit/abd0056ea5745f3baaf94b7a5965c54141422b57) code format run. - [`016be0a`](https://github.com/microsoft/terminal/commit/016be0acf882fbba7890580cf9b76949e67e41a2) add comment for why int cast one is blocked out - [`a34a855`](https://github.com/microsoft/terminal/commit/a34a85552bcd1819ebd3f1fad03179a141d4ecd2) Fix error in test logic for x86 environments. - [`952d92a`](https://github.com/microsoft/terminal/commit/952d92a8851d185a459df7c766c8a46a585a1f0c) SA pass. - [`e05d830`](https://github.com/microsoft/terminal/commit/e05d830861aa6e5438f6ec05f4fd12b340247d55) Use multiplication to see if there was a remainder instead of modulo since we already did division (for perf reasons, per PR.) - [`9192d9c`](https://github.com/microsoft/terminal/commit/9192d9c4b1481ea155f21dea877b872bda83d049) Revert OpenConsole.sln - [`b9da020`](https://github.com/microsoft/terminal/commit/b9da020fe8f118cd8606335c32021bf9ab951c56) Add a natvis for til::size - [`c063e3e`](https://github.com/microsoft/terminal/commit/c063e3ed50344c67d42088cc188a192a0ba3c65f) Merge branch 'dev/miniksa/til_size' of https://github.com/microsoft/terminal into dev/miniksa/til_size - [`bd10986`](https://github.com/microsoft/terminal/commit/bd1098658c27f9a8002004829ec7bb0544002e41) Merge branch 'master' into dev/miniksa/til_size ### 📊 Changes **8 files changed** (+791 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/inc/til.h` (+1 -0) ➕ `src/inc/til/size.h` (+265 -0) 📝 `src/til/precomp.h` (+10 -0) ➕ `src/til/ut_til/SizeTests.cpp` (+494 -0) 📝 `src/til/ut_til/SomeTests.cpp` (+0 -1) 📝 `src/til/ut_til/til.unit.tests.vcxproj` (+1 -0) ➕ `src/til/ut_til/til.unit.tests.vcxproj.filters` (+15 -0) 📝 `tools/ConsoleTypes.natvis` (+5 -1) </details> ### 📄 Description ## Summary of the Pull Request Introduces convenience type `til::size` which automatically implements our best practices for size-related types and provides automatic conversions in/out of the relevant types. ## PR Checklist * [x] In support of Differental Rendering #778 * [X] I work here. * [x] Tests added/passed * [x] I'm a core contributor. ## Detailed Description of the Pull Request / Additional comments - Automatically converts in from anything with a X/Y (console `COORD`) or cx/cy (Win32 `SIZE`) - Automatically converts out to `COORD`, `SIZE`, or `D2D1_SIZE_F`. - Constructs from bare integers written into source file - Default constructs to empty - Uses Chromium Math for all basic math operations (+, -, *, /) - Provides equality tests - Adds initial proposal for division-to-ceiling (round up division) that attempts to `ceil` without any floating point math. - Accessors for height/width - Type converting accessors (that use safe conversions and throw) for height/width - Convenience function for area calculation (as that's common with type) and uses safe math to do it. - TAEF/WEX Output and Comparators so they will print very nicely with `VERIFY` and `Log` macros in our testing suite. ## Validation Steps Performed - See automated tests of functionality. --- <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:13:06 +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#25982