Added support for a basic link parser
This commit is contained in:
Vendored
+85
@@ -539,6 +539,13 @@ declare module 'xterm' {
|
||||
*/
|
||||
deregisterLinkMatcher(matcherId: number): void;
|
||||
|
||||
/**
|
||||
* (EXPERIMENTAL) Registers a link provider, allowing a custom parser to
|
||||
* be used to match and handle links.
|
||||
* @param linkProvider
|
||||
*/
|
||||
registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
|
||||
|
||||
/**
|
||||
* (EXPERIMENTAL) Registers a character joiner, allowing custom sequences of
|
||||
* characters to be rendered as a single unit. This is useful in particular
|
||||
@@ -887,6 +894,84 @@ declare module 'xterm' {
|
||||
row: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A custom link provider
|
||||
*/
|
||||
interface ILinkProvider {
|
||||
/**
|
||||
* Provides a link a buffer position
|
||||
* @param position
|
||||
* @param callback
|
||||
*/
|
||||
provideLink(position: IBufferCellPosition, callback: (link: ILink | undefined) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A link
|
||||
*/
|
||||
interface ILink {
|
||||
/**
|
||||
* The buffer range of the link
|
||||
*/
|
||||
range: IBufferRange;
|
||||
|
||||
/**
|
||||
* The url of the link
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* The show tooltip callback
|
||||
* @param event
|
||||
* @param link
|
||||
*/
|
||||
showTooltip(event: MouseEvent, link: string): void;
|
||||
|
||||
/**
|
||||
* The hide tooltip callback
|
||||
* @param event
|
||||
* @param link
|
||||
*/
|
||||
hideTooltip(event: MouseEvent, link: string): void;
|
||||
|
||||
/**
|
||||
* Handles when the link is opened
|
||||
* @param event
|
||||
* @param link
|
||||
*/
|
||||
handle(event: MouseEvent, link: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A range in the buffer
|
||||
*/
|
||||
interface IBufferRange {
|
||||
/**
|
||||
* The start position of the range
|
||||
*/
|
||||
start: IBufferCellPosition;
|
||||
|
||||
/**
|
||||
* The end position of the range
|
||||
*/
|
||||
end: IBufferCellPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* A position in the buffer
|
||||
*/
|
||||
interface IBufferCellPosition {
|
||||
/**
|
||||
* The x of the buffer position
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* The y of the buffer position
|
||||
*/
|
||||
y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a terminal buffer.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user