From 53bd4c6a3541450c99396b564875fe7693406940 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Tue, 9 Jun 2020 14:22:32 -0700 Subject: [PATCH 1/3] UIA: retrieve full buffer size sometimes --- src/types/UiaTextRangeBase.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/types/UiaTextRangeBase.cpp b/src/types/UiaTextRangeBase.cpp index 3245620e369..28bcfac4fd0 100644 --- a/src/types/UiaTextRangeBase.cpp +++ b/src/types/UiaTextRangeBase.cpp @@ -145,7 +145,9 @@ const COORD UiaTextRangeBase::GetEndpoint(TextPatternRangeEndpoint endpoint) con // - true if range is degenerate, false otherwise. bool UiaTextRangeBase::SetEndpoint(TextPatternRangeEndpoint endpoint, const COORD val) noexcept { - const auto bufferSize = _getBufferSize(); + // GH#6402: Get the actual buffer size here, instead of the one + // constructed by the virtual bottom. + const auto bufferSize = _pData->GetTextBuffer().GetSize(); switch (endpoint) { case TextPatternRangeEndpoint_End: @@ -393,7 +395,9 @@ IFACEMETHODIMP UiaTextRangeBase::GetBoundingRectangles(_Outptr_result_maybenull_ // set of coords. std::vector coords; - const auto bufferSize = _getBufferSize(); + // GH#6402: Get the actual buffer size here, instead of the one + // constructed by the virtual bottom. + const auto bufferSize = _pData->GetTextBuffer().GetSize(); // these viewport vars are converted to the buffer coordinate space const auto viewport = bufferSize.ConvertToOrigin(_pData->GetViewport()); From acbe2fee67a41f874bcb1eb7f247e87e4235cb7e Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Mon, 20 Jul 2020 06:57:25 -0700 Subject: [PATCH 2/3] constructed --> constrained Co-authored-by: Dustin L. Howett --- 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 28bcfac4fd0..030364bb6fc 100644 --- a/src/types/UiaTextRangeBase.cpp +++ b/src/types/UiaTextRangeBase.cpp @@ -146,7 +146,7 @@ const COORD UiaTextRangeBase::GetEndpoint(TextPatternRangeEndpoint endpoint) con bool UiaTextRangeBase::SetEndpoint(TextPatternRangeEndpoint endpoint, const COORD val) noexcept { // GH#6402: Get the actual buffer size here, instead of the one - // constructed by the virtual bottom. + // constrained by the virtual bottom. const auto bufferSize = _pData->GetTextBuffer().GetSize(); switch (endpoint) { @@ -396,7 +396,7 @@ IFACEMETHODIMP UiaTextRangeBase::GetBoundingRectangles(_Outptr_result_maybenull_ std::vector coords; // GH#6402: Get the actual buffer size here, instead of the one - // constructed by the virtual bottom. + // constrained by the virtual bottom. const auto bufferSize = _pData->GetTextBuffer().GetSize(); // these viewport vars are converted to the buffer coordinate space From 02465e0f48b10a20e24bc79a7cbec5bc0dd8ff49 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Mon, 20 Jul 2020 18:29:33 -0400 Subject: [PATCH 3/3] add TODO comment --- src/types/UiaTextRangeBase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types/UiaTextRangeBase.cpp b/src/types/UiaTextRangeBase.cpp index 030364bb6fc..7d12fb42762 100644 --- a/src/types/UiaTextRangeBase.cpp +++ b/src/types/UiaTextRangeBase.cpp @@ -286,6 +286,8 @@ IFACEMETHODIMP UiaTextRangeBase::ExpandToEnclosingUnit(_In_ TextUnit unit) noexc } else { + // TODO GH#6986: properly handle "end of buffer" as last character + // instead of last cell // expand to document _start = bufferSize.Origin(); _end = bufferSize.EndExclusive();