Refresh hovered hyperlink on scroll

This commit is contained in:
Carlos Zamora
2026-06-23 15:48:32 -07:00
parent 8824b02a78
commit 373f966276
2 changed files with 17 additions and 0 deletions

View File

@@ -247,6 +247,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
[weakThis = get_weak()](const auto& update) {
if (auto core{ weakThis.get() }; core && !core->_IsClosing())
{
// GH#20219: re-evaluate if we're hovering over a hyperlink after scrolling
core->_refreshHoveredCell();
core->ScrollPositionChanged.raise(*core, update);
}
});
@@ -749,6 +751,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_terminal->UserScrollViewport(viewTop);
}
// GH#20219: re-evaluate if we're hovering over a hyperlink after scrolling
_refreshHoveredCell();
const auto shared = _shared.lock_shared();
if (shared->outputIdle)
{
@@ -835,11 +840,22 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
_updateHoveredCell(std::optional<til::point>{ pos });
}
void ControlCore::ClearHoveredCell()
{
_updateHoveredCell(std::nullopt);
}
void ControlCore::_refreshHoveredCell()
{
if (_lastHoveredCell)
{
const auto cell = *_lastHoveredCell;
_lastHoveredCell.reset();
_updateHoveredCell(cell);
}
}
void ControlCore::_updateHoveredCell(const std::optional<til::point> terminalPosition)
{
if (terminalPosition == _lastHoveredCell)

View File

@@ -353,6 +353,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void _connectionOutputHandler(winrt::array_view<const char16_t> str);
void _connectionStateChangedHandler(const TerminalConnection::ITerminalConnection&, const Windows::Foundation::IInspectable&);
void _updateHoveredCell(const std::optional<til::point> terminalPosition);
void _refreshHoveredCell();
void _setOpacity(const float opacity, const bool focused = true);
bool _isBackgroundTransparent();