terminal
terminal copied to clipboard
Replace UIA CompareInBounds with til::point comparators
This PR replaces the uses of Viewport::CompareInBounds() in the UIA code with til::point comparators. Additionally, it simplifies the logic further by using std::max and std::min.
In doing so, we are no longer hitting the assert in CompareInBounds().
Closes #14542
Since this looks like a new version of #13244, which was reverted in #13907, I may need an explanation as to why the reason stated for the revert doesn't apply :smile:
@DHowett
Ok. This is "great". Here's what happened:
- PR #13244:
- this code:
if (!bufferSize.IsInBounds(_start, true) || !bufferSize.IsInBounds(_end, true))
{
THROW_HR(E_FAIL);
}
- is replaced with this code:
THROW_HR_IF(E_FAIL, !bufferSize.IsInBounds(_start) || !bufferSize.IsInBounds(_end));
- Due to this specific change, #13866 occurs. Turns out, the rest of the change is mostly fine. But since we were prepping for a release, it was much easier to revert the change (that's definitely on me).
- This PR:
- This time around, I'm not making that mistake of removing the
true. I've manually verified that #13866 doesn't occur. - Also, #13244 included a change to remove the second param from
IsInBounds(), which is what specifically lead to the change above.
- This time around, I'm not making that mistake of removing the
We could still do the other CompareInBounds() replacements throughout the codebase (as in #13244). Figured specifically focusing on UIA would be nicer though.
Hello @carlos-zamora!
Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.