From e7e3e538b415de6bd72ee00c5fbe0ff3e2ef5b92 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Mon, 3 Feb 2020 11:30:07 -0800 Subject: [PATCH] Adjust GetBoundingRect for Inclusive end --- src/types/UiaTextRangeBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/UiaTextRangeBase.cpp b/src/types/UiaTextRangeBase.cpp index ee3af26095a..804d4758540 100644 --- a/src/types/UiaTextRangeBase.cpp +++ b/src/types/UiaTextRangeBase.cpp @@ -983,7 +983,7 @@ const unsigned int UiaTextRangeBase::_getViewportHeight(const SMALL_RECT viewpor void UiaTextRangeBase::_getBoundingRect(_In_ const COORD startAnchor, _In_ const COORD endAnchor, _Inout_ std::vector& coords) const { FAIL_FAST_IF(startAnchor.Y != endAnchor.Y); - FAIL_FAST_IF(startAnchor.X >= endAnchor.X); + FAIL_FAST_IF(startAnchor.X > endAnchor.X); const auto viewport = _pData->GetViewport(); const auto currentFontSize = _getScreenFontSize(); @@ -1005,7 +1005,7 @@ void UiaTextRangeBase::_getBoundingRect(_In_ const COORD startAnchor, _In_ const #pragma warning(suppress : 26496) // analysis can't see this, TODO GH: 4015 to improve Viewport to be less bad because it'd go away if ConvertToOrigin returned instead of inout'd. auto endCoord = endAnchor; viewport.ConvertToOrigin(&endCoord); - bottomRight.x = base::ClampMul(endCoord.X, currentFontSize.X); + bottomRight.x = base::ClampMul(base::ClampAdd(endCoord.X, 1), currentFontSize.X); bottomRight.y = base::ClampMul(base::ClampAdd(endCoord.Y, 1), currentFontSize.Y); // convert the coords to be relative to the screen instead of