mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add clearSelection API
This commit is contained in:
@@ -180,6 +180,16 @@ export class SelectionManager extends EventEmitter {
|
||||
return result.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current terminal selection.
|
||||
*/
|
||||
public clearSelection(): void {
|
||||
this._model.selectionStart = null;
|
||||
this._model.selectionEnd = null;
|
||||
this._removeMouseDownListeners();
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a buffer line to a string, with optional start and end columns.
|
||||
* Wide characters will count as two columns in the resulting string. This
|
||||
|
||||
@@ -1389,6 +1389,13 @@ Terminal.prototype.getSelection = function() {
|
||||
return prepareTextForClipboard(this.selectionManager.selectionText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current terminal selection.
|
||||
*/
|
||||
Terminal.prototype.clearSelection = function() {
|
||||
this.selectionManager.clearSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects all text within the terminal.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user