From eea839990833f8eebfbc795c2e61a30814ff2dbd Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 23 Oct 2024 12:27:52 -0700 Subject: [PATCH] Fix hyperlinks --- src/cascadia/TerminalCore/Terminal.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index 2a6553922ea..4629081e3b3 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -477,7 +477,7 @@ bool Terminal::ShouldSendAlternateScroll(const unsigned int uiButton, // - The position relative to the viewport std::wstring Terminal::GetHyperlinkAtViewportPosition(const til::point viewportPos) { - return GetHyperlinkAtBufferPosition(_ConvertToBufferCell(viewportPos)); + return GetHyperlinkAtBufferPosition(_ConvertToBufferCell(viewportPos, false)); } std::wstring Terminal::GetHyperlinkAtBufferPosition(const til::point bufferPos) @@ -501,12 +501,8 @@ std::wstring Terminal::GetHyperlinkAtBufferPosition(const til::point bufferPos) result = GetHyperlinkIntervalFromViewportPosition(viewportPos); if (result.has_value()) { - // GetPlainText and _ConvertToBufferCell work with inclusive coordinates, but interval's - // stop point is (horizontally) exclusive, so let's just update it. - result->stop.x--; - - result->start = _ConvertToBufferCell(result->start); - result->stop = _ConvertToBufferCell(result->stop); + result->start = _ConvertToBufferCell(result->start, false); + result->stop = _ConvertToBufferCell(result->stop, false); } } else @@ -1465,7 +1461,6 @@ PointTree Terminal::_getPatterns(til::CoordType beg, til::CoordType end) const // PointTree uses half-open ranges and viewport-relative coordinates. range.start.y -= beg; range.end.y -= beg; - range.end.x++; intervals.push_back(PointTree::interval(range.start, range.end, 0)); } while (uregex_findNext(re.get(), &status)); }