UNPKG

jupyterlab-emrys

Version:

A computational environment for Jupyter. Powered by Emrys

165 lines (164 loc) 4.23 kB
import { ITerminalSession } from 'jupyter-js-services'; import { Message } from 'phosphor-messaging'; import { ResizeMessage, Widget } from 'phosphor-widget'; /** * A widget which manages a terminal session. */ export declare class TerminalWidget extends Widget { /** * Construct a new terminal widget. * * @param options - The terminal configuration options. */ constructor(options?: TerminalWidget.IOptions); /** * The terminal session associated with the widget. */ session: ITerminalSession; /** * Get the font size of the terminal in pixels. */ /** * Set the font size of the terminal in pixels. */ fontSize: number; /** * Get the background color of the terminal. */ /** * Set the background color of the terminal. */ background: string; /** * Get the text color of the terminal. */ /** * Set the text color of the terminal. */ color: string; /** * Get whether the bell is shown. */ /** * Set whether the bell is shown. */ visualBell: boolean; /** * Get whether to focus on a bell event. */ /** * Set whether to focus on a bell event. */ popOnBell: boolean; /** * Get the size of the scrollback buffer in the terminal. */ /** * Set the size of the scrollback buffer in the terminal. */ scrollback: number; /** * Dispose of the resources held by the terminal widget. */ dispose(): void; /** * Process a message sent to the widget. * * @param msg - The message sent to the widget. * * #### Notes * Subclasses may reimplement this method as needed. */ processMessage(msg: Message): void; /** * Set the size of the terminal when attached if dirty. */ protected onAfterAttach(msg: Message): void; /** * Set the size of the terminal when shown if dirty. */ protected onAfterShow(msg: Message): void; /** * Dispose of the terminal when closing. */ protected onCloseRequest(msg: Message): void; /** * On resize, use the computed row and column sizes to resize the terminal. */ protected onResize(msg: ResizeMessage): void; /** * A message handler invoked on an `'update-request'` message. */ protected onUpdateRequest(msg: Message): void; /** * A message handler invoked on an `'fit-request'` message. */ protected onFitRequest(msg: Message): void; /** * Create the terminal object. */ private _initializeTerm(); /** * Handle a message from the terminal session. */ private _onMessage(sender, msg); /** * Use the dummy terminal to measure the row and column sizes. */ private _snapTermSizing(); /** * Resize the terminal based on the computed geometry. * * The parent offset dimensions should be `-1` if unknown. */ private _resizeTerminal(offsetWidth, offsetHeight); private _term; private _sheet; private _dummyTerm; private _fontSize; private _dirty; private _rowHeight; private _colWidth; private _background; private _color; private _box; private _session; } /** * The namespace for `TerminalWidget` class statics. */ export declare namespace TerminalWidget { /** * Options for the terminal widget. */ interface IOptions { /** * The font size of the terminal in pixels. */ fontSize?: number; /** * The background color of the terminal. */ background?: string; /** * The text color of the terminal. */ color?: string; /** * Whether to blink the cursor. Can only be set at startup. */ cursorBlink?: boolean; /** * Whether to show a bell in the terminal. */ visualBell?: boolean; /** * Whether to focus on a bell event. */ popOnBell?: boolean; /** * The size of the scrollback buffer in the terminal. */ scrollback?: number; } }