Send mousemove events when x10Mouse is true

This commit is contained in:
Daniel Imms
2018-06-26 07:26:14 -07:00
parent a9a506f7db
commit e24dca3e29
+14 -17
View File
@@ -1002,7 +1002,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
return this.cancel(ev); return this.cancel(ev);
} }
// TODO: Seems dangerous to attach event listeners to document, could they be done on element?
// TODO: All mouse handling should be pulled into its own file. // TODO: All mouse handling should be pulled into its own file.
// bind events // bind events
@@ -1020,22 +1019,20 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
} }
// x10 compatibility mode can't send button releases // x10 compatibility mode can't send button releases
if (!this.x10Mouse) { const handler = (ev: MouseEvent) => {
const handler = (ev: MouseEvent) => { if (this.normalMouse && !this.x10Mouse) {
if (this.normalMouse) { sendButton(ev);
sendButton(ev); }
} if (moveHandler) {
if (moveHandler) { // Even though this should only be attached when this.normalMouse is true, holding the
// Even though this should only be attached when this.normalMouse is true, holding the // mouse button down when normalMouse changes can happen. Just always try to remove it.
// mouse button down when normalMouse changes can happen. Just always try to remove it. off(this._document, 'mousemove', moveHandler);
off(this._document, 'mousemove', moveHandler); moveHandler = null;
moveHandler = null; }
} off(this._document, 'mouseup', handler);
off(this._document, 'mouseup', handler); return this.cancel(ev);
return this.cancel(ev); };
}; on(this._document, 'mouseup', handler);
on(this._document, 'mouseup', handler);
}
return this.cancel(ev); return this.cancel(ev);
}); });