Skip to content

Commit

Permalink
Fix releasing alt sometimes not hiding locked hovers
Browse files Browse the repository at this point in the history
- CompositeMouseTracker.isMouseIn's initial state is now true, this means
releasing alt without moving the mouse will not hide the hover
- The current hover options are now only cleared when the hover being
disposed is the active hover, this was the main cause of the problem because
if current hover options is undefined while there is an active hover weird
things could happen

Fixes #150842
  • Loading branch information
Tyriar committed Jun 3, 2022
1 parent 42b35cb commit ea381c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/vs/workbench/services/hover/browser/hoverService.ts
Expand Up @@ -38,7 +38,11 @@ export class HoverService implements IHoverService {
const hoverDisposables = new DisposableStore();
const hover = this._instantiationService.createInstance(HoverWidget, options);
hover.onDispose(() => {
this._currentHoverOptions = undefined;
// Only clear the current options if it's the current hover, the current options help
// reduce flickering when the same hover is shown multiple times
if (this._currentHoverOptions === options) {
this._currentHoverOptions = undefined;
}
hoverDisposables.dispose();
});
const provider = this._contextViewService as IContextViewProvider;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/services/hover/browser/hoverWidget.ts
Expand Up @@ -507,7 +507,7 @@ export class HoverWidget extends Widget {
}

class CompositeMouseTracker extends Widget {
private _isMouseIn: boolean = false;
private _isMouseIn: boolean = true;
private _mouseTimeout: number | undefined;

private readonly _onMouseOut = this._register(new Emitter<void>());
Expand Down

0 comments on commit ea381c9

Please sign in to comment.