Skip to content

TerminalControl fix: Invalidate hovered hyperlink on scroll#20239

Open
VasuBhakt wants to merge 1 commit into
microsoft:mainfrom
VasuBhakt:fix/stale-hyperlink-hover-on-scroll
Open

TerminalControl fix: Invalidate hovered hyperlink on scroll#20239
VasuBhakt wants to merge 1 commit into
microsoft:mainfrom
VasuBhakt:fix/stale-hyperlink-hover-on-scroll

Conversation

@VasuBhakt
Copy link
Copy Markdown

@VasuBhakt VasuBhakt commented May 17, 2026

Summary of the Pull Request

Invalidate the cached hovered hyperlink state after mouse-wheel scrolling, so the hover underline is re-evaluated when the viewport shifts under a stationary cursor.

References and Relevant Issues

Closes #20219

Detailed Description of the Pull Request / Additional comments

When the user scrolls with the mouse wheel without moving the cursor, _mouseScrollHandler calls UpdateScrollbar which shifts the viewport, but _lastHoveredCell was never invalidated. Since the cached viewport coordinates hadn't changed, _updateHoveredCell hit its early-return guard and skipped re-querying the buffer entirely. This left the hover underline stuck on a hyperlink that had scrolled away, even when plain text was now under the cursor.

The fix calls ClearHoveredCell immediately after UpdateScrollbar to bust the cache, then re-queries at the same pixel position via SetHoveredCell. This ensures the hover state always reflects the actual buffer cell under the cursor after a scroll.

Validation Steps Performed

Manually reproduced the bug as described in #20219, hovered an OSC 8 hyperlink in Windows Terminal, kept the mouse stationary, and scrolled with the mouse wheel. The hover underline visibly persisted on the scrolled-away link. The fix has not been validated with a local build due to build environment constraints, but the change is minimal and targeted.

PR Checklist

When the user scrolls with the mouse wheel while the cursor is
stationary, the viewport shifts but _lastHoveredCell was never
invalidated. This caused stale hyperlink hover highlights to persist
even when plain text was now under the cursor.

Fix by clearing and re-evaluating the hovered cell immediately after
UpdateScrollbar in _mouseScrollHandler.

Closes microsoft#20219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hovered hyperlink state is not invalidated when buffer content or viewport mapping changes under a stationary cursor

1 participant