Expose getSelectionPosition and select APIs instead

This commit is contained in:
Daniel Imms
2019-05-11 23:52:38 -07:00
parent da7c39e526
commit 5bbbbf7348
7 changed files with 71 additions and 21 deletions
+38 -8
View File
@@ -670,25 +670,30 @@ declare module 'xterm' {
*/
hasSelection(): boolean;
/**
* Selects text within the terminal.
* @param column The column the selection starts at..
* @param row The row the selection starts at.
* @param length The length of the selection.
*/
setSelection(column: number, row: number, length: number): void;
/**
* Gets the terminal's current selection, this is useful for implementing
* copy behavior outside of xterm.js.
*/
getSelection(): string;
/**
* Gets the selection position or undefined if there is no selection.
*/
getSelectionPosition(): ISelectionPosition | undefined;
/**
* Clears the current terminal selection.
*/
clearSelection(): void;
/**
* Selects text within the terminal.
* @param column The column the selection starts at..
* @param row The row the selection starts at.
* @param length The length of the selection.
*/
select(column: number, row: number, length: number): void;
/**
* Selects all text within the terminal.
*/
@@ -872,6 +877,31 @@ declare module 'xterm' {
static applyAddon(addon: any): void;
}
/**
* An object representing a selecrtion within the terminal.
*/
interface ISelectionPosition {
/**
* The start column of the selection.
*/
startColumn: number;
/**
* The start row of the selection.
*/
startRow: number;
/**
* The end column of the selection.
*/
endColumn: number;
/**
* The end row of the selection.
*/
endRow: number;
}
interface IBuffer {
/**
* The y position of the cursor. This ranges between `0` (when the