Polish API

This commit is contained in:
Daniel Imms
2020-02-07 09:30:12 -08:00
parent a066bbe32f
commit ef071ac7ac
+22 -20
View File
@@ -739,8 +739,9 @@ declare module 'xterm' {
/** /**
* (EXPERIMENTAL) Registers a link provider, allowing a custom parser to * (EXPERIMENTAL) Registers a link provider, allowing a custom parser to
* be used to match and handle links. * be used to match and handle links. Multiple link providers can be used,
* @param linkProvider * they will be asked in the order in which they are registered.
* @param linkProvider The link provider to use to detect links.
*/ */
registerLinkProvider(linkProvider: ILinkProvider): IDisposable; registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
@@ -1081,79 +1082,80 @@ declare module 'xterm' {
} }
/** /**
* A custom link provider * A custom link provider.
*/ */
interface ILinkProvider { interface ILinkProvider {
/** /**
* Provides a link a buffer position * Provides a link a buffer position
* @param position * @param position The position of the buffer that is currently active.
* @param callback * @param callback The callback to be fired with the resulting link or
* `undefined` when ready.
*/ */
provideLink(position: IBufferCellPosition, callback: (link: ILink | undefined) => void): void; provideLink(position: IBufferCellPosition, callback: (link: ILink | undefined) => void): void;
} }
/** /**
* A link * A link within the terminal.
*/ */
interface ILink { interface ILink {
/** /**
* The buffer range of the link * The buffer range of the link.
*/ */
range: IBufferRange; range: IBufferRange;
/** /**
* The url of the link * The url of the link.
*/ */
url: string; url: string;
/** /**
* The show tooltip callback * Called when the link's tooltip is ready to show.
* @param event * @param event The mouse event triggering the callback.
* @param link * @param link
*/ */
showTooltip?(event: MouseEvent, link: string): void; showTooltip?(event: MouseEvent, link: string): void;
/** /**
* The hide tooltip callback * Called when the link's tooltip is ready to hide.
* @param event * @param event The mouse event triggering the callback.
* @param link * @param link
*/ */
hideTooltip?(event: MouseEvent, link: string): void; hideTooltip?(event: MouseEvent, link: string): void;
/** /**
* Handles when the link is opened * Calls when the link is activated.
* @param event * @param event The mouse event triggering the callback.
* @param link * @param link
*/ */
handle(event: MouseEvent, link: string): void; handle(event: MouseEvent, link: string): void;
} }
/** /**
* A range in the buffer * A range within a buffer.
*/ */
interface IBufferRange { interface IBufferRange {
/** /**
* The start position of the range * The start position of the range.
*/ */
start: IBufferCellPosition; start: IBufferCellPosition;
/** /**
* The end position of the range * The end position of the range.
*/ */
end: IBufferCellPosition; end: IBufferCellPosition;
} }
/** /**
* A position in the buffer * A position within a buffer.
*/ */
interface IBufferCellPosition { interface IBufferCellPosition {
/** /**
* The x of the buffer position * The x position within the buffer.
*/ */
x: number; x: number;
/** /**
* The y of the buffer position * The y position within the buffer.
*/ */
y: number; y: number;
} }