[PR #13313] [CLOSED] [1.14] Remove most uses of CompareInBounds #29467

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13313
Author: @carlos-zamora
Created: 6/16/2022
Status: Closed

Base: release-1.14Head: dev/cazamor/1.14/replace-compareInBounds


📝 Commits (7)

📊 Changes

4 files changed (+78 additions, -68 deletions)

View changed files

📝 src/buffer/out/textBuffer.cpp (+34 -20)
📝 src/cascadia/TerminalCore/TerminalSelection.cpp (+3 -3)
📝 src/interactivity/win32/ut_interactivity_win32/UiaTextRangeTests.cpp (+2 -2)
📝 src/types/UiaTextRangeBase.cpp (+39 -43)

📄 Description

Summary of the Pull Request

⚠️Targets 1.14⚠️

Replaces most uses of Viewport::CompareInBounds() with til::point's < and > operators. CompareInBounds has been the cause of a bunch of UIA crashes over the years. Replacing them entirely ensures that the FAILFAST_IF isn't ever touched.

This was a bit tricky to do because I wanted to ensure the same functionality was maintained. Since we still have a ton of COORDs floating around, I just cast to til::point when we're about to do a comparison. We could do smarter changes, but I'm concerned that could cause a bug we could miss.

References

#13183
#13244 - same PR but for main


🔄 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/13313 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 6/16/2022 **Status:** ❌ Closed **Base:** `release-1.14` ← **Head:** `dev/cazamor/1.14/replace-compareInBounds` --- ### 📝 Commits (7) - [`783b479`](https://github.com/microsoft/terminal/commit/783b4796069288322f9cbf47a0c3c0ee1e2138ca) Remove most uses of `CompareInBounds` - [`47458ae`](https://github.com/microsoft/terminal/commit/47458ae7f75c675908f5f97b762f08e9317a8e3d) address PR comments - [`9c61dcf`](https://github.com/microsoft/terminal/commit/9c61dcfcfed9b453adfbd792c5e12d7c9d6c7e73) clamp to inclusive pos & compare returns 0/1 - [`73be370`](https://github.com/microsoft/terminal/commit/73be370e89f8e3474f9e5c190cf94eb955bfd81b) fix test - [`0f04f8b`](https://github.com/microsoft/terminal/commit/0f04f8b7fe80fbc75631e36377035b9e16ab1e0b) make 'MoveToNextGlyph' prettier - [`70ee157`](https://github.com/microsoft/terminal/commit/70ee1578f5ad0addbeb3632c09abd3e9604828db) fix build - [`f0e47ed`](https://github.com/microsoft/terminal/commit/f0e47ed32f9f6df0c16e27a6cfb00c06969d6776) address PR feedback ### 📊 Changes **4 files changed** (+78 additions, -68 deletions) <details> <summary>View changed files</summary> 📝 `src/buffer/out/textBuffer.cpp` (+34 -20) 📝 `src/cascadia/TerminalCore/TerminalSelection.cpp` (+3 -3) 📝 `src/interactivity/win32/ut_interactivity_win32/UiaTextRangeTests.cpp` (+2 -2) 📝 `src/types/UiaTextRangeBase.cpp` (+39 -43) </details> ### 📄 Description ## Summary of the Pull Request ⚠️Targets 1.14⚠️ Replaces most uses of `Viewport::CompareInBounds()` with `til::point`'s `<` and `>` operators. `CompareInBounds` has been the cause of a bunch of UIA crashes over the years. Replacing them entirely ensures that the `FAILFAST_IF` isn't ever touched. This was a bit tricky to do because I wanted to ensure the same functionality was maintained. Since we still have a ton of `COORD`s floating around, I just cast to `til::point` when we're about to do a comparison. We _could_ do smarter changes, but I'm concerned that could cause a bug we could miss. ## References #13183 #13244 - same PR but for `main` --- <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:35: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#29467