/** * Copyright (c) 2018 The xterm.js authors. All rights reserved. * @license MIT */ import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm'; import type { IEvent } from './primitives/Event'; import type { CursorStyle, IColorEvent, ColorIndex, ColorRequestType, IDisposable, IParams, SpecialColorIndex } from './primitives/Types'; // TODO: The options that are not in the public API should be reviewed export interface ITerminalOptions extends IPublicTerminalOptions { [key: string]: any; convertEol?: boolean; termName?: string; } export interface IScrollEvent { position: number; } export interface IModes { insertMode: boolean; } export interface IDecPrivateModes { applicationCursorKeys: boolean; applicationKeypad: boolean; bracketedPasteMode: boolean; colorSchemeUpdates: boolean; cursorBlink: boolean | undefined; cursorStyle: CursorStyle | undefined; origin: boolean; reverseWraparound: boolean; sendFocus: boolean; synchronizedOutput: boolean; win32InputMode: boolean; wraparound: boolean; // defaults: xterm - true, vt100 - false } /** * Kitty keyboard protocol state. * Maintains per-screen stacks of enhancement flags. */ export interface IKittyKeyboardState { /** Current active enhancement flags (for current screen) */ flags: number; /** Saved flags for main screen when alt is active */ mainFlags: number; /** Saved flags for alternate screen when main is active */ altFlags: number; /** Stack of flags for main screen */ mainStack: number[]; /** Stack of flags for alternate screen */ altStack: number[]; } /** * windowOptions */ export interface IWindowOptions { restoreWin?: boolean; minimizeWin?: boolean; setWinPosition?: boolean; setWinSizePixels?: boolean; raiseWin?: boolean; lowerWin?: boolean; refreshWin?: boolean; setWinSizeChars?: boolean; maximizeWin?: boolean; fullscreenWin?: boolean; getWinState?: boolean; getWinPosition?: boolean; getWinSizePixels?: boolean; getScreenSizePixels?: boolean; getCellSizePixels?: boolean; getWinSizeChars?: boolean; getScreenSizeChars?: boolean; getIconTitle?: boolean; getWinTitle?: boolean; pushTitle?: boolean; popTitle?: boolean; setWinLines?: boolean; } /** * Calls the parser and handles actions generated by the parser. */ export interface IInputHandler { onTitleChange: IEvent; parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise; print(data: Uint32Array, start: number, end: number): void; registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable; registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable; registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable; registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable; registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise): IDisposable; /** C0 BEL */ bell(): boolean; /** C0 LF */ lineFeed(): boolean; /** C0 CR */ carriageReturn(): boolean; /** C0 BS */ backspace(): boolean; /** C0 HT */ tab(): boolean; /** C0 SO */ shiftOut(): boolean; /** C0 SI */ shiftIn(): boolean; /** CSI @ */ insertChars(params: IParams): boolean; /** CSI SP @ */ scrollLeft(params: IParams): boolean; /** CSI A */ cursorUp(params: IParams): boolean; /** CSI SP A */ scrollRight(params: IParams): boolean; /** CSI B */ cursorDown(params: IParams): boolean; /** CSI C */ cursorForward(params: IParams): boolean; /** CSI D */ cursorBackward(params: IParams): boolean; /** CSI E */ cursorNextLine(params: IParams): boolean; /** CSI F */ cursorPrecedingLine(params: IParams): boolean; /** CSI G */ cursorCharAbsolute(params: IParams): boolean; /** CSI H */ cursorPosition(params: IParams): boolean; /** CSI I */ cursorForwardTab(params: IParams): boolean; /** CSI J */ eraseInDisplay(params: IParams): boolean; /** CSI K */ eraseInLine(params: IParams): boolean; /** CSI L */ insertLines(params: IParams): boolean; /** CSI M */ deleteLines(params: IParams): boolean; /** CSI P */ deleteChars(params: IParams): boolean; /** CSI S */ scrollUp(params: IParams): boolean; /** CSI T */ scrollDown(params: IParams, collect?: string): boolean; /** CSI X */ eraseChars(params: IParams): boolean; /** CSI Z */ cursorBackwardTab(params: IParams): boolean; /** CSI ` */ charPosAbsolute(params: IParams): boolean; /** CSI a */ hPositionRelative(params: IParams): boolean; /** CSI b */ repeatPrecedingCharacter(params: IParams): boolean; /** CSI c */ sendDeviceAttributesPrimary(params: IParams): boolean; /** CSI > c */ sendDeviceAttributesSecondary(params: IParams): boolean; /** CSI d */ linePosAbsolute(params: IParams): boolean; /** CSI e */ vPositionRelative(params: IParams): boolean; /** CSI f */ hVPosition(params: IParams): boolean; /** CSI g */ tabClear(params: IParams): boolean; /** CSI h */ setMode(params: IParams, collect?: string): boolean; /** CSI l */ resetMode(params: IParams, collect?: string): boolean; /** CSI m */ charAttributes(params: IParams): boolean; /** CSI n */ deviceStatus(params: IParams, collect?: string): boolean; /** CSI p */ softReset(params: IParams, collect?: string): boolean; /** CSI q */ setCursorStyle(params: IParams, collect?: string): boolean; /** CSI r */ setScrollRegion(params: IParams, collect?: string): boolean; /** CSI s */ saveCursor(params: IParams): boolean; /** CSI u */ restoreCursor(params: IParams): boolean; /** CSI ' } */ insertColumns(params: IParams): boolean; /** CSI ' ~ */ deleteColumns(params: IParams): boolean; /** OSC 0 */ /** OSC 2 */ setTitle(data: string): boolean; /** OSC 4 */ setOrReportIndexedColor(data: string): boolean; /** OSC 10 */ setOrReportFgColor(data: string): boolean; /** OSC 11 */ setOrReportBgColor(data: string): boolean; /** OSC 12 */ setOrReportCursorColor(data: string): boolean; /** OSC 104 */ restoreIndexedColor(data: string): boolean; /** OSC 110 */ restoreFgColor(data: string): boolean; /** OSC 111 */ restoreBgColor(data: string): boolean; /** OSC 112 */ restoreCursorColor(data: string): boolean; /** ESC E */ nextLine(): boolean; /** ESC = */ keypadApplicationMode(): boolean; /** ESC > */ keypadNumericMode(): boolean; /** ESC % G */ /** ESC % @ */ selectDefaultCharset(): boolean; /** ESC ( C */ /** ESC ) C */ /** ESC * C */ /** ESC + C */ /** ESC - C */ /** ESC . C */ /** ESC / C */ selectCharset(collectAndFlag: string): boolean; /** ESC D */ index(): boolean; /** ESC H */ tabSet(): boolean; /** ESC M */ reverseIndex(): boolean; /** ESC c */ fullReset(): boolean; /** ESC n */ /** ESC o */ /** ESC | */ /** ESC } */ /** ESC ~ */ setgLevel(level: number): boolean; /** ESC # 8 */ screenAlignmentPattern(): boolean; } export interface IParseStack { paused: boolean; cursorStartX: number; cursorStartY: number; decodedLength: number; position: number; }