From c5810e6d545f39b00f9e5100cd24e10406b05e92 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 27 Jan 2022 13:20:02 -0600 Subject: [PATCH] Take 1 of api --- typings/xterm.d.ts | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 39245afe5..83c1d10c9 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -405,6 +405,69 @@ declare module 'xterm' { onDispose: IEvent; } + /** + * Represents a decoration in the terminal that is associated with a particular marker. + */ + export interface IDecoration extends IDisposable { + /** + * Whether this decoration is disposed. + */ + readonly isDisposed: boolean; + + /** + * The actual line index in the buffer at this point in time. This is set to + * -1 if the decoration has been disposed. + */ + readonly line: number; + + /** + * An event fired when the decoration + * is rendered, returns the dom element + * associated with the decoration. + */ + onRender: IEvent; + } + + export interface IDecorationOptions extends IDisposable { + /** + * The line in the terminal where + * the decoration will be displayed + */ + startMarker: IMarker; + + /** + * The number of milliseconds the decoration + * should be displayed for. + */ + displayDuration?: number; + + /** + * The color of the decoration + */ + color?: string + } + + export interface IBufferDecorationOptions extends IDecorationOptions { + /** + * The type of buffer decoration + */ + type: 'button' | 'box-border'; + + /* + * The x position for the decoration. + * Defaults to the right edge. + */ + position?: number; + } + + export interface IGutterDecorationOptions extends IDecorationOptions { + /** + * The end line in the terminal for + * the decoration + */ + endMarker: IMarker; + } + /** * The set of localizable strings. */ @@ -870,6 +933,13 @@ declare module 'xterm' { */ addMarker(cursorYOffset: number): IMarker | undefined; + /** + * (EXPERIMENTAL) Adds a decoration as configured with @param decorationOptions to the + * normal buffer or gutter and returns it. + * If the alt buffer is active or the decoration is invalid, undefined is returned. + */ + registerDecoration(decorationOptions: IBufferDecorationOptions | IGutterDecorationOptions): IDecoration | undefined; + /** * Gets whether the terminal has an active selection. */