TerminalControl fix: Invalidate hovered hyperlink on scroll#20239
Open
VasuBhakt wants to merge 1 commit into
Open
TerminalControl fix: Invalidate hovered hyperlink on scroll#20239VasuBhakt wants to merge 1 commit into
VasuBhakt wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,
_mouseScrollHandlercallsUpdateScrollbarwhich shifts the viewport, but_lastHoveredCellwas never invalidated. Since the cached viewport coordinates hadn't changed,_updateHoveredCellhit 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
ClearHoveredCellimmediately afterUpdateScrollbarto bust the cache, then re-queries at the same pixel position viaSetHoveredCell. 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