Add terminal API interface to Types.ts
This is needed since the API/public buffer now differs from the TerminalCore's
This commit is contained in:
+41
-2
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable } from 'xterm';
|
import { ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable, IMarker } from 'xterm';
|
||||||
import { IColorSet, IRenderer } from './renderer/Types';
|
import { IColorSet, IRenderer } from './renderer/Types';
|
||||||
import { IMouseZoneManager } from './ui/Types';
|
import { IMouseZoneManager } from './ui/Types';
|
||||||
import { ICharset } from './core/Types';
|
import { ICharset } from './core/Types';
|
||||||
@@ -202,7 +202,7 @@ export interface ILinkHoverEvent {
|
|||||||
fg: number;
|
fg: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAccessor, ILinkifierAccessor {
|
export interface ITerminal extends IPublicTerminal, IElementAccessor, IBufferAccessor, ILinkifierAccessor {
|
||||||
screenElement: HTMLElement;
|
screenElement: HTMLElement;
|
||||||
selectionManager: ISelectionManager;
|
selectionManager: ISelectionManager;
|
||||||
charMeasure: ICharMeasure;
|
charMeasure: ICharMeasure;
|
||||||
@@ -231,6 +231,45 @@ export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAcce
|
|||||||
showCursor(): void;
|
showCursor(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IPublicTerminal extends IDisposable, IEventEmitter {
|
||||||
|
textarea: HTMLTextAreaElement;
|
||||||
|
rows: number;
|
||||||
|
cols: number;
|
||||||
|
buffer: IBuffer;
|
||||||
|
markers: IMarker[];
|
||||||
|
blur(): void;
|
||||||
|
focus(): void;
|
||||||
|
resize(columns: number, rows: number): void;
|
||||||
|
writeln(data: string): void;
|
||||||
|
open(parent: HTMLElement): void;
|
||||||
|
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
|
||||||
|
addCsiHandler(flag: string, callback: (params: number[], collect: string) => boolean): IDisposable;
|
||||||
|
addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
|
||||||
|
registerLinkMatcher(regex: RegExp, handler: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): number;
|
||||||
|
deregisterLinkMatcher(matcherId: number): void;
|
||||||
|
registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
|
||||||
|
deregisterCharacterJoiner(joinerId: number): void;
|
||||||
|
addMarker(cursorYOffset: number): IMarker;
|
||||||
|
hasSelection(): boolean;
|
||||||
|
getSelection(): string;
|
||||||
|
clearSelection(): void;
|
||||||
|
selectAll(): void;
|
||||||
|
selectLines(start: number, end: number): void;
|
||||||
|
dispose(): void;
|
||||||
|
destroy(): void;
|
||||||
|
scrollLines(amount: number): void;
|
||||||
|
scrollPages(pageCount: number): void;
|
||||||
|
scrollToTop(): void;
|
||||||
|
scrollToBottom(): void;
|
||||||
|
scrollToLine(line: number): void;
|
||||||
|
clear(): void;
|
||||||
|
write(data: string): void;
|
||||||
|
getOption(key: string): any;
|
||||||
|
setOption(key: string, value: any): void;
|
||||||
|
refresh(start: number, end: number): void;
|
||||||
|
reset(): void;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IBufferAccessor {
|
export interface IBufferAccessor {
|
||||||
buffer: IBuffer;
|
buffer: IBuffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
`${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +
|
`${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +
|
||||||
` color: ${this.colorManager.colors.foreground.css};` +
|
` color: ${this.colorManager.colors.foreground.css};` +
|
||||||
` background-color: ${this.colorManager.colors.background.css};` +
|
` background-color: ${this.colorManager.colors.background.css};` +
|
||||||
` font-family: ${this._terminal.getOption('fontFamily')};` +
|
` font-family: ${this._terminal.options.fontFamily};` +
|
||||||
` font-size: ${this._terminal.getOption('fontSize')}px;` +
|
` font-size: ${this._terminal.options.fontSize}px;` +
|
||||||
`}`;
|
`}`;
|
||||||
// Text styles
|
// Text styles
|
||||||
styles +=
|
styles +=
|
||||||
|
|||||||
Vendored
+1
-1
@@ -275,7 +275,7 @@ declare module 'xterm' {
|
|||||||
* A callback that fires when the mouse leaves a link. Note that this can
|
* A callback that fires when the mouse leaves a link. Note that this can
|
||||||
* happen even when tooltipCallback hasn't fired for the link yet.
|
* happen even when tooltipCallback hasn't fired for the link yet.
|
||||||
*/
|
*/
|
||||||
leaveCallback?: (event: MouseEvent, uri: string) => boolean | void;
|
leaveCallback?: () => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The priority of the link matcher, this defines the order in which the link
|
* The priority of the link matcher, this defines the order in which the link
|
||||||
|
|||||||
Reference in New Issue
Block a user