Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate cursor position in UIA UTR ctor #12436

Merged
merged 4 commits into from
Feb 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/types/UiaTextRangeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ try
{
RETURN_IF_FAILED(RuntimeClassInitialize(pData, pProvider, wordDelimiters));

// GH#8730: The cursor position may be in a delayed state, resulting in it being out of bounds.
// If that's the case, clamp it to be within bounds.
// TODO GH#XXXX: We should be able to just check some fields off of the Cursor object,
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved
// but Windows Terminal isn't updating those flags properly.
_start = cursor.GetPosition();
if (const auto bufferSize{ pData->GetTextBuffer().GetSize() }; !bufferSize.IsInBounds(_start))
{
bufferSize.Clamp(_start);
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved
}
_end = _start;

UiaTracing::TextRange::Constructor(*this);
Expand Down