Merge branch 'master' into 553_find_api
This commit is contained in:
+3
-49
@@ -87,23 +87,6 @@ export class SelectionManager extends EventEmitter {
|
||||
*/
|
||||
private _dragScrollAmount: number;
|
||||
|
||||
/**
|
||||
* The last time the mousedown event fired, this is used to track double and
|
||||
* triple clicks.
|
||||
*/
|
||||
private _lastMouseDownTime: number;
|
||||
|
||||
/**
|
||||
* The last position the mouse was clicked [x, y].
|
||||
*/
|
||||
private _lastMousePosition: [number, number];
|
||||
|
||||
/**
|
||||
* The number of clicks of the mousedown event. This is used to keep track of
|
||||
* double and triple clicks.
|
||||
*/
|
||||
private _clickCount: number;
|
||||
|
||||
/**
|
||||
* The current selection mode.
|
||||
*/
|
||||
@@ -136,7 +119,6 @@ export class SelectionManager extends EventEmitter {
|
||||
this.enable();
|
||||
|
||||
this._model = new SelectionModel(_terminal);
|
||||
this._lastMouseDownTime = 0;
|
||||
this._activeSelectionMode = SelectionMode.NORMAL;
|
||||
}
|
||||
|
||||
@@ -351,16 +333,14 @@ export class SelectionManager extends EventEmitter {
|
||||
// Reset drag scroll state
|
||||
this._dragScrollAmount = 0;
|
||||
|
||||
this._setMouseClickCount(event);
|
||||
|
||||
if (event.shiftKey) {
|
||||
this._onShiftClick(event);
|
||||
} else {
|
||||
if (this._clickCount === 1) {
|
||||
if (event.detail === 1) {
|
||||
this._onSingleClick(event);
|
||||
} else if (this._clickCount === 2) {
|
||||
} else if (event.detail === 2) {
|
||||
this._onDoubleClick(event);
|
||||
} else if (this._clickCount === 3) {
|
||||
} else if (event.detail === 3) {
|
||||
this._onTripleClick(event);
|
||||
}
|
||||
}
|
||||
@@ -446,32 +426,6 @@ export class SelectionManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of clicks for the current mousedown event based on the time
|
||||
* and position of the last mousedown event.
|
||||
* @param event The mouse event.
|
||||
*/
|
||||
private _setMouseClickCount(event: MouseEvent): void {
|
||||
let currentTime = (new Date()).getTime();
|
||||
if (currentTime - this._lastMouseDownTime > CLEAR_MOUSE_DOWN_TIME || this._distanceFromLastMousePosition(event) > CLEAR_MOUSE_DISTANCE) {
|
||||
this._clickCount = 0;
|
||||
}
|
||||
this._lastMouseDownTime = currentTime;
|
||||
this._lastMousePosition = [event.pageX, event.pageY];
|
||||
this._clickCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum number of pixels in each direction the mouse has moved.
|
||||
* @param event The mouse event.
|
||||
*/
|
||||
private _distanceFromLastMousePosition(event: MouseEvent): number {
|
||||
const result = Math.max(
|
||||
Math.abs(this._lastMousePosition[0] - event.pageX),
|
||||
Math.abs(this._lastMousePosition[1] - event.pageY));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the mousemove event when the mouse button is down, recording the
|
||||
* end of the selection and refreshing the selection.
|
||||
|
||||
+9
-5
@@ -1238,12 +1238,12 @@ Terminal.prototype.scrollDisp = function(disp, suppressScrollEvent) {
|
||||
this.userScrolling = false;
|
||||
}
|
||||
|
||||
this.ydisp += disp;
|
||||
const oldYdisp = this.ydisp;
|
||||
this.ydisp = Math.max(Math.min(this.ydisp + disp, this.ybase), 0);
|
||||
|
||||
if (this.ydisp > this.ybase) {
|
||||
this.ydisp = this.ybase;
|
||||
} else if (this.ydisp < 0) {
|
||||
this.ydisp = 0;
|
||||
// No change occurred, don't trigger scroll/refresh
|
||||
if (oldYdisp === this.ydisp) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!suppressScrollEvent) {
|
||||
@@ -1940,6 +1940,10 @@ Terminal.prototype.resize = function(x, y) {
|
||||
, addToY;
|
||||
|
||||
if (x === this.cols && y === this.rows) {
|
||||
// Check if we still need to measure the char size (fixes #785).
|
||||
if (!this.charMeasure.width || !this.charMeasure.height) {
|
||||
this.charMeasure.measure();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user