+10
-3
@@ -307,6 +307,15 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
|
|||||||
return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));
|
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.
|
* Handles te mousedown event, setting up for a new selection.
|
||||||
* @param event The mousedown event.
|
* @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
|
// Allow selection when using a specific modifier key, even when disabled
|
||||||
if (!this._enabled) {
|
if (!this._enabled) {
|
||||||
const shouldForceSelection = Browser.isMac ? event.altKey : event.shiftKey;
|
if (!this.shouldForceSelection(event)) {
|
||||||
|
|
||||||
if (!shouldForceSelection) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -943,7 +943,12 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.focus();
|
this.focus();
|
||||||
|
|
||||||
if (!this.mouseEvents) return;
|
// Don't send the mouse button to the pty if mouse events are disabled or
|
||||||
|
// if the selection manager is having selection forced (ie. a modifier is
|
||||||
|
// held).
|
||||||
|
if (!this.mouseEvents || this.selectionManager.shouldForceSelection(ev)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// send the button
|
// send the button
|
||||||
sendButton(ev);
|
sendButton(ev);
|
||||||
|
|||||||
Reference in New Issue
Block a user