Add IBuffer, IBufferSet and fix CircularList type

This commit is contained in:
Daniel Imms
2017-07-16 03:47:15 +03:00
committed by Paris Kasidiaris
parent cb5a452c90
commit 59f75555bc
6 changed files with 41 additions and 17 deletions
+26 -4
View File
@@ -33,9 +33,8 @@ export interface ITerminal {
cursorState: number;
defAttr: number;
scrollback: number;
buffers: any; // This should be a `BufferSet` class, but it would result in circular dependency
buffer: any; // This should be a `Buffer` class, but it would result in circular dependency
viewport: any; // This should be a `Viewport` class, but it would result in circular dependency
buffers: IBufferSet;
buffer: IBuffer;
/**
* Emit the 'data' event and populate the given data.
@@ -51,6 +50,24 @@ export interface ITerminal {
showCursor(): void;
}
export interface IBuffer {
lines: ICircularList<[number, string, number][]>;
ydisp: number;
ybase: number;
y: number;
x: number;
tabs: any;
}
export interface IBufferSet {
alt: IBuffer;
normal: IBuffer;
active: IBuffer;
activateNormalBuffer(): void;
activateAltBuffer(): void;
}
export interface ISelectionManager {
selectionText: string;
selectionStart: [number, number];
@@ -72,7 +89,7 @@ export interface ILinkifier {
deregisterLinkMatcher(matcherId: number): boolean;
}
interface ICircularList<T> {
export interface ICircularList<T> extends IEventEmitter {
length: number;
maxLength: number;
@@ -86,6 +103,11 @@ interface ICircularList<T> {
shiftElements(start: number, count: number, offset: number): void;
}
export interface IEventEmitter {
on(type, listener): void;
off(type, listener): void;
}
export interface LinkMatcherOptions {
/**
* The index of the link from the regex.match(text) call. This defaults to 0