mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-25 08:47:40 +00:00
Add hasSelection public API
This commit is contained in:
parent
9e47ec9af2
commit
1343b83fc3
@ -145,6 +145,13 @@ export class SelectionManager extends EventEmitter {
|
||||
this._buffer = buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether there is an active text selection.
|
||||
*/
|
||||
public get hasSelection(): boolean {
|
||||
return !!this._model.finalSelectionStart && !!this._model.finalSelectionEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text currently selected.
|
||||
*/
|
||||
|
||||
@ -1373,11 +1373,18 @@ Terminal.prototype.deregisterLinkMatcher = function(matcherId) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the terminal has an active selection.
|
||||
*/
|
||||
Terminal.prototype.hasSelection = function() {
|
||||
return this.selectionManager.hasSelection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the terminal's current selection, this is useful for implementing copy
|
||||
* behavior outside of xterm.js.
|
||||
*/
|
||||
Terminal.prototype.getSelectionText = function() {
|
||||
Terminal.prototype.getSelection = function() {
|
||||
// TODO: Should prepareTextForClipboard logic be moved to SelectionManager?
|
||||
return prepareTextForClipboard(this.selectionManager.selectionText);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user