Don't send mouse events when selection is forced

Fixes #1090
This commit is contained in:
Daniel Imms
2017-10-27 16:48:00 -07:00
parent 8ece306dbe
commit d81df46453
2 changed files with 16 additions and 4 deletions
+10 -3
View File
@@ -307,6 +307,15 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));
}
/**
* Returns whether the selection manager should force selection, regardless of
* whether the terminal is in mouse events mode.
* @param event The mouse event.
*/
public shouldForceSelection(event: MouseEvent): boolean {
return Browser.isMac ? event.altKey : event.shiftKey;
}
/**
* Handles te mousedown event, setting up for a new selection.
* @param event The mousedown event.
@@ -325,9 +334,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
// Allow selection when using a specific modifier key, even when disabled
if (!this._enabled) {
const shouldForceSelection = Browser.isMac ? event.altKey : event.shiftKey;
if (!shouldForceSelection) {
if (!this.shouldForceSelection(event)) {
return;
}