From 729033098e428ba49f8fbe4d6031869fc2e0d036 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Fri, 17 Jan 2025 12:31:14 -0800 Subject: [PATCH] Fix failing test & ExpandSelectionToWord --- src/cascadia/TerminalCore/TerminalSelection.cpp | 4 ++-- src/host/selection.cpp | 2 +- src/host/ut_host/SelectionTests.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cascadia/TerminalCore/TerminalSelection.cpp b/src/cascadia/TerminalCore/TerminalSelection.cpp index 3bbaf2c1d7a..b32c2d1e0d4 100644 --- a/src/cascadia/TerminalCore/TerminalSelection.cpp +++ b/src/cascadia/TerminalCore/TerminalSelection.cpp @@ -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)) diff --git a/src/host/selection.cpp b/src/host/selection.cpp index 0856cc9b201..f94e0808057 100644 --- a/src/host/selection.cpp +++ b/src/host/selection.cpp @@ -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, diff --git a/src/host/ut_host/SelectionTests.cpp b/src/host/ut_host/SelectionTests.cpp index cd27e1eae5d..f314e8dcc9e 100644 --- a/src/host/ut_host/SelectionTests.cpp +++ b/src/host/ut_host/SelectionTests.cpp @@ -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"); } }