Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Minor datatip fixes
Browse files Browse the repository at this point in the history
Summary:
1) On Windows, modifier keys are also subject to key repeat. So we shouldn't try to repeatedly fetch modifier datatips (#20)
2) We try to blacklist the current mouse position in certain scenarios. However, since moving the mouse clears the blacklist, it's only safe to set this once. `getBufferPosition` forces a layout recalculation so it's expensive! (#94)
Closes facebookarchive/nuclide#1347

Reviewed By: wbinnssmith

Differential Revision: D6097902

Pulled By: hansonw

fbshipit-source-id: c1bd27900a0604d7654abfc0aa15baabf740cf77
  • Loading branch information
hansonw committed Oct 19, 2017
1 parent c075764 commit a227573
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions modules/atom-ide-ui/pkg/atom-ide-datatip/lib/DatatipManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ class DatatipManagerForEditor {
Observable.fromEvent(this._editorView, 'keydown').subscribe(e => {
const modifierKey = getModifierKeyFromKeyboardEvent(e);
if (modifierKey) {
// On Windows, key repeat applies to modifier keys too!
// So it's quite possible that we hit this twice without hitting keyup.
if (this._heldKeys.has(modifierKey)) {
return;
}
this._heldKeys.add(modifierKey);
if (this._datatipState !== DatatipState.HIDDEN) {
this._fetchInResponseToKeyPress();
Expand Down Expand Up @@ -602,11 +607,13 @@ class DatatipManagerForEditor {
this._datatipState === DatatipState.HIDDEN ||
this._datatipState === DatatipState.FETCHING
) {
this._blacklistedPosition = getBufferPosition(
this._editor,
this._editorView,
this._lastMoveEvent,
);
if (this._blacklistedPosition == null) {
this._blacklistedPosition = getBufferPosition(
this._editor,
this._editorView,
this._lastMoveEvent,
);
}
return;
}

Expand Down

0 comments on commit a227573

Please sign in to comment.