Skip to content

Commit

Permalink
Fix failing test & ExpandSelectionToWord
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Jan 17, 2025
1 parent 4764653 commit 7290330
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/cascadia/TerminalCore/TerminalSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ void Terminal::ExpandSelectionToWord()
const auto& buffer = _activeBuffer();
auto selection{ _selection.write() };
wil::hide_name _selection;
selection->start = buffer.GetWordStart(selection->start, _wordDelimiters);
selection->start = buffer.GetWordStart2(selection->start, _wordDelimiters, false);
selection->pivot = selection->start;
selection->end = buffer.GetWordEnd(selection->end, _wordDelimiters);
selection->end = buffer.GetWordEnd2(selection->end, _wordDelimiters, false);

// if we're targeting both endpoints, instead just target "end"
if (WI_IsFlagSet(_selectionEndpoint, SelectionEndpoint::Start) && WI_IsFlagSet(_selectionEndpoint, SelectionEndpoint::End))
Expand Down
2 changes: 1 addition & 1 deletion src/host/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Selection::_RegenerateSelectionSpans() const
const auto blockSelection = !IsLineSelection();
const auto& buffer = screenInfo.GetTextBuffer();
auto startSelectionAnchor = _d->coordSelectionAnchor;
buffer.GetSize().IncrementInExclusiveBounds(startSelectionAnchor.x <= endSelectionAnchor.x ? endSelectionAnchor : startSelectionAnchor);
buffer.GetSize().IncrementInExclusiveBounds(startSelectionAnchor <= endSelectionAnchor ? endSelectionAnchor : startSelectionAnchor);
_lastSelectionSpans = buffer.GetTextSpans(startSelectionAnchor,
endSelectionAnchor,
blockSelection,
Expand Down
6 changes: 3 additions & 3 deletions src/host/ut_host/SelectionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ class SelectionTests
}
}

void VerifyGetSelectionSpans_LineMode(const til::point start, const til::point end)
void VerifyGetSelectionSpans_LineMode(const til::point inclusiveStart, const til::point inclusiveEnd)
{
const auto selectionSpans = m_pSelection->GetSelectionSpans();

if (VERIFY_ARE_EQUAL(1u, selectionSpans.size()))
{
auto& span{ selectionSpans[0] };
VERIFY_ARE_EQUAL(start, span.start, L"start");
VERIFY_ARE_EQUAL(inclusiveStart, span.start, L"start");

const til::point exclusiveEnd{ end.x + 1, end.y };
const til::point exclusiveEnd{ inclusiveEnd.x + 1, inclusiveEnd.y };
VERIFY_ARE_EQUAL(exclusiveEnd, span.end, L"end");
}
}
Expand Down

0 comments on commit 7290330

Please sign in to comment.