Skip to content

Commit

Permalink
Merge branch 'master' into 760_erase_in_display_scroll_bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Jul 13, 2017
2 parents e4770de + 25fc01c commit 9a358b2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 56 deletions.
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true,
"**/build": true,
"**/lib": true
}
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ Xterm.js is used in several world-class applications to provide great terminal e
- [**Codenvy**](http://www.codenvy.com): Cloud workspaces for development teams.
- [**CoderPad**](https://coderpad.io): Online interviewing platform for programmers. Run code in many programming languages, with results displayed by `xterm.js`.
- [**WebSSH2**](https://github.com/billchurch/WebSSH2): A web based SSH2 client using `xterm.js`, socket.io, and ssh2.
- [**Spyder Terminal**](https://github.com/spyder-ide/spyder-terminal): A full fledged system terminal embedded on Spyder IDE.
- [**Spyder Terminal**](https://github.com/spyder-ide/spyder-terminal): A full fledged system terminal embedded on Spyder IDE.
- [**Cloud Commander**](https://cloudcmd.io "Cloud Commander"): Orthodox web file manager with console and editor.
- [**Codevolve**](https://www.codevolve.com "Codevolve"): Online platform for interactive coding and web development courses. Live container-backed terminal uses `xterm.js`.
- [**RStudio**](https://www.rstudio.com/products/RStudio "RStudio"): RStudio is an integrated development environment (IDE) for R.
- [**Terminal for Atom**](https://github.com/jsmecham/atom-terminal-tab): A simple terminal for the Atom text editor.
- [**Eclipse Orion**](https://orionhub.org): A modern, open source software development environment that runs in the cloud. Code, deploy and run in the cloud.
- [**Gravitational Teleport**](https://github.com/gravitational/teleport): Gravitational Teleport is a modern SSH server for remotely accessing clusters of Linux servers via SSH or HTTPS.
- [**Hexlet**](https://en.hexlet.io): Practical programming courses (JavaScript, PHP, Unix, databases, functional programming). A steady path from the first line of code to the first job.
- [**Hexlet**](https://en.hexlet.io): Practical programming courses (JavaScript, PHP, Unix, databases, functional programming). A steady path from the first line of code to the first job.
- [**Selenoid UI**](https://github.com/aerokube/selenoid-ui): Simple UI for the scallable golang implementation of Selenium Hub named Selenoid. We use XTerm for streaming logs over websockets from docker containers.
- [**Portainer**](https://portainer.io): Simple management UI for Docker.
- [**SSHy**](https://github.com/stuicey/SSHy): HTML5 Based SSHv2 Web Client with E2E encryption utilising `xterm.js`, SJCL & websockets.


Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it in our list.
Expand Down
52 changes: 3 additions & 49 deletions src/SelectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,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.
*/
Expand Down Expand Up @@ -135,7 +118,6 @@ export class SelectionManager extends EventEmitter {
this.enable();

this._model = new SelectionModel(_terminal);
this._lastMouseDownTime = 0;
this._activeSelectionMode = SelectionMode.NORMAL;
}

Expand Down Expand Up @@ -396,16 +378,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);
}
}
Expand Down Expand Up @@ -491,32 +471,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.
Expand Down
14 changes: 9 additions & 5 deletions src/xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,12 +1237,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) {
Expand Down Expand Up @@ -1939,6 +1939,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;
}

Expand Down

0 comments on commit 9a358b2

Please sign in to comment.