Merge pull request #1958 from nikonso/1947-weblinks-with-selection

WebLinks plugin don't follow link on selection
This commit is contained in:
Daniel Imms
2019-03-30 15:07:34 -07:00
committed by GitHub
+10 -2
View File
@@ -29,6 +29,7 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
private _tooltipTimeout: number = null;
private _currentZone: IMouseZone = null;
private _lastHoverCoords: [number, number] = [null, null];
private _initialSelectionLength: number;
constructor(
private _terminal: ITerminal
@@ -157,6 +158,10 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
}
private _onMouseDown(e: MouseEvent): void {
// Store current terminal selection length, to check if we're performing
// a selection operation
this._initialSelectionLength = this._terminal.getSelection().length;
// Ignore the event if there are no zones active
if (!this._areZonesActive) {
return;
@@ -186,9 +191,12 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
}
private _onClick(e: MouseEvent): void {
// Find the active zone and click it if found
// Find the active zone and click it if found and no selection was
// being performed
const zone = this._findZoneEventAt(e);
if (zone) {
const currentSelectionLength = this._terminal.getSelection().length;
if (zone && currentSelectionLength === this._initialSelectionLength) {
zone.clickCallback(e);
e.preventDefault();
e.stopImmediatePropagation();