Skip to content

Add xterm mouseleave to dismiss widget#66576

Merged
Tyriar merged 2 commits intomicrosoft:masterfrom
rcbevans:rievans/dismisswidgetonleavexterm
Jan 24, 2019
Merged

Add xterm mouseleave to dismiss widget#66576
Tyriar merged 2 commits intomicrosoft:masterfrom
rcbevans:rievans/dismisswidgetonleavexterm

Conversation

@rcbevans
Copy link
Contributor

Add a disposable listener to the 'mouseleave' event on the
terminalInstance xterm.element to dismiss any showing widget,
in case the user moves their mouse out of the xterm area directly,
without leaving the link that generated the widget/tooltip.

The real problem is xterm.js does not appear to be listening to the
'mouseleave' event of its own dom element, and so it does not fire
leaveCallback for registered CustomLinkHandler, WebLinkHandler, or
LocalLinkHandlers. As a result, if the user has the terminal split near
the link that generated the widget/tooltip, the widget remains until the
mouse cursor re-enters the xterm area that generated it, for xterm to
dismiss itself. See gif in #66421 for demonstration of the problem.

fixes #66421

Add a disposable listener to the 'mouseleave' event on the
terminalInstance xterm.element to dismiss any showing widget,
in case the user moves their mouse out of the xterm area directly,
without leaving the link that generated the widget/tooltip.

The real problem is xterm.js does not appear to be listening to the
'mouseleave' event of its own dom element, and so it does not fire
leaveCallback for registered CustomLinkHandler, WebLinkHandler, or
LocalLinkHandlers.  As a result, if the user has the terminal split near
the link that generated the widget/tooltip, the widget remains until the
mouse cursor re-enters the xterm area that generated it, for xterm to
dismiss itself.  See gif in microsoft#66421 for demonstration of the problem.

fixes microsoft#66421
@rcbevans
Copy link
Contributor Author

rcbevans commented Jan 16, 2019

I have created this PR, which does address the issue, as visible to users, as described in #66421, I believe the real issue actually lies in xterm.js, and this is a workaround rather than a fix.

terminalLinkHander.ts registers the various link handler callbacks which xterm uses to notify vscode that the mouse is over an actionable link, via the tooltipCallback and leaveCallback of the handlers.

If a user mouses over a link which reaches the edge of the xterm window, such as in the case where the terminal is split, and the divider is at the edge of an xterm actionable link, and the user moves the mouse directly out of the xterm element, without leaving the link first, xterm does not fire the leaveCallback event for the handler. This means VS Code wasn't hiding the tooltip/widget. In my opinion, xterm.js should get a fix so that if the mouse leaves the xterm text area where the link is, the leaveCallback of any active links should fire.

A side effect of this workaround, rather than true fix, is that whilst the widget VS Code was displaying now disappears correctly, the xterm link remains underlined in white. If the mouse cursor re-enters the xterm area off of the link, xterm then fires the leaveCallback, and the underline is removed from the link.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rcbevans 😃

@Tyriar Tyriar added this to the December/January 2019 milestone Jan 24, 2019
@Tyriar Tyriar merged commit 6846f58 into microsoft:master Jan 24, 2019
@rcbevans rcbevans deleted the rievans/dismisswidgetonleavexterm branch March 26, 2019 00:20
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto-link tooltip of integrated terminal does not disappear under some conditions

2 participants