Skip to content

Commit

Permalink
Merge remote-tracking branch 'ups/master' into 484_truecolor_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Jul 15, 2017
2 parents 06ff1da + c94fdae commit 64175cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
12 changes: 0 additions & 12 deletions src/SelectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ const DRAG_SCROLL_MAX_SPEED = 15;
*/
const DRAG_SCROLL_INTERVAL = 50;

/**
* The amount of time before mousedown events are no longer stacked to create
* double/triple click events.
*/
const CLEAR_MOUSE_DOWN_TIME = 400;

/**
* The number of pixels in each direction that the mouse must move before
* mousedown events are no longer stacked to create double/triple click events.
*/
const CLEAR_MOUSE_DISTANCE = 10;

/**
* A string containing all characters that are considered word separated by the
* double click to select work logic.
Expand Down
17 changes: 13 additions & 4 deletions src/xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1457,29 +1457,33 @@ Terminal.prototype.deregisterLinkMatcher = function(matcherId) {
* Gets whether the terminal has an active selection.
*/
Terminal.prototype.hasSelection = function() {
return this.selectionManager.hasSelection;
return this.selectionManager ? this.selectionManager.hasSelection : false;
};

/**
* Gets the terminal's current selection, this is useful for implementing copy
* behavior outside of xterm.js.
*/
Terminal.prototype.getSelection = function() {
return this.selectionManager.selectionText;
return this.selectionManager ? this.selectionManager.selectionText : '';
};

/**
* Clears the current terminal selection.
*/
Terminal.prototype.clearSelection = function() {
this.selectionManager.clearSelection();
if (this.selectionManager) {
this.selectionManager.clearSelection();
}
};

/**
* Selects all text within the terminal.
*/
Terminal.prototype.selectAll = function() {
this.selectionManager.selectAll();
if (this.selectionManager) {
this.selectionManager.selectAll();
}
};

/**
Expand Down Expand Up @@ -2249,6 +2253,11 @@ Terminal.prototype.handler = function(data) {
return;
}

// Clear the selection if the selection manager is available and has an active selection
if (this.selectionManager && this.selectionManager.hasSelection) {
this.selectionManager.clearSelection();
}

// Input is being sent to the terminal, the terminal should focus the prompt.
if (this.ybase !== this.ydisp) {
this.scrollToBottom();
Expand Down

0 comments on commit 64175cc

Please sign in to comment.