Resolve todos
This commit is contained in:
+2
-2
@@ -93,7 +93,7 @@ export interface IInputHandlingTerminal extends IEventEmitter {
|
|||||||
scroll(isWrapped?: boolean): void;
|
scroll(isWrapped?: boolean): void;
|
||||||
nextStop(x?: number): number;
|
nextStop(x?: number): number;
|
||||||
setgLevel(g: number): void;
|
setgLevel(g: number): void;
|
||||||
eraseAttr(): any;
|
eraseAttr(): number;
|
||||||
eraseRight(x: number, y: number): void;
|
eraseRight(x: number, y: number): void;
|
||||||
eraseLine(y: number): void;
|
eraseLine(y: number): void;
|
||||||
eraseLeft(x: number, y: number): void;
|
eraseLeft(x: number, y: number): void;
|
||||||
@@ -107,7 +107,7 @@ export interface IInputHandlingTerminal extends IEventEmitter {
|
|||||||
reset(): void;
|
reset(): void;
|
||||||
showCursor(): void;
|
showCursor(): void;
|
||||||
refresh(start: number, end: number): void;
|
refresh(start: number, end: number): void;
|
||||||
matchColor(r1: number, g1: number, b1: number): any;
|
matchColor(r1: number, g1: number, b1: number): number;
|
||||||
error(text: string, data?: any): void;
|
error(text: string, data?: any): void;
|
||||||
setOption(key: string, value: any): void;
|
setOption(key: string, value: any): void;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-18
@@ -182,11 +182,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
private compositionView: HTMLElement;
|
private compositionView: HTMLElement;
|
||||||
private charSizeStyleElement: HTMLStyleElement;
|
private charSizeStyleElement: HTMLStyleElement;
|
||||||
|
|
||||||
// TODO: This should be removed from the interface, opting for modules to pull
|
|
||||||
// in Browser for themselves.
|
|
||||||
public browser: IBrowser = <any>Browser;
|
public browser: IBrowser = <any>Browser;
|
||||||
|
|
||||||
// TODO: Options should be private, remove from interface in favor of getOption
|
|
||||||
public options: ITerminalOptions;
|
public options: ITerminalOptions;
|
||||||
private colors: any;
|
private colors: any;
|
||||||
|
|
||||||
@@ -194,8 +191,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
public cursorState: number;
|
public cursorState: number;
|
||||||
public cursorHidden: boolean;
|
public cursorHidden: boolean;
|
||||||
public convertEol: boolean;
|
public convertEol: boolean;
|
||||||
// TODO: This is the data queue for send, improve name and documentation
|
|
||||||
private queue: string;
|
private sendDataQueue: string;
|
||||||
private customKeyEventHandler: CustomKeyEventHandler;
|
private customKeyEventHandler: CustomKeyEventHandler;
|
||||||
// The ID from a setInterval that tracks the blink animation. This animation
|
// The ID from a setInterval that tracks the blink animation. This animation
|
||||||
// is done in JS due to a Chromium bug with CSS animations that thrashed the
|
// is done in JS due to a Chromium bug with CSS animations that thrashed the
|
||||||
@@ -339,7 +336,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
|
|
||||||
this.cursorState = 0;
|
this.cursorState = 0;
|
||||||
this.cursorHidden = false;
|
this.cursorHidden = false;
|
||||||
this.queue = '';
|
this.sendDataQueue = '';
|
||||||
this.customKeyEventHandler = null;
|
this.customKeyEventHandler = null;
|
||||||
this.cursorBlinkInterval = null;
|
this.cursorBlinkInterval = null;
|
||||||
|
|
||||||
@@ -402,7 +399,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
/**
|
/**
|
||||||
* back_color_erase feature for xterm.
|
* back_color_erase feature for xterm.
|
||||||
*/
|
*/
|
||||||
public eraseAttr(): any {
|
public eraseAttr(): number {
|
||||||
// if (this.is('screen')) return this.defAttr;
|
// if (this.is('screen')) return this.defAttr;
|
||||||
return (this.defAttr & ~0x1ff) | (this.curAttr & 0x1ff);
|
return (this.defAttr & ~0x1ff) | (this.curAttr & 0x1ff);
|
||||||
}
|
}
|
||||||
@@ -1886,14 +1883,14 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
* @param {string} data
|
* @param {string} data
|
||||||
*/
|
*/
|
||||||
public send(data: string): void {
|
public send(data: string): void {
|
||||||
if (!this.queue) {
|
if (!this.sendDataQueue) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.handler(this.queue);
|
this.handler(this.sendDataQueue);
|
||||||
this.queue = '';
|
this.sendDataQueue = '';
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.queue += data;
|
this.sendDataQueue += data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2261,7 +2258,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
|
|
||||||
// Expose to InputHandler
|
// Expose to InputHandler
|
||||||
// TODO: Revise when truecolor is introduced.
|
// TODO: Revise when truecolor is introduced.
|
||||||
public matchColor(r1: number, g1: number, b1: number): any {
|
public matchColor(r1: number, g1: number, b1: number): number {
|
||||||
const hash = (r1 << 16) | (g1 << 8) | b1;
|
const hash = (r1 << 16) | (g1 << 8) | b1;
|
||||||
|
|
||||||
if (matchColorCache[hash] != null) {
|
if (matchColorCache[hash] != null) {
|
||||||
@@ -2271,11 +2268,11 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
|||||||
let ldiff = Infinity;
|
let ldiff = Infinity;
|
||||||
let li = -1;
|
let li = -1;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let c;
|
let c: number[];
|
||||||
let r2;
|
let r2: number;
|
||||||
let g2;
|
let g2: number;
|
||||||
let b2;
|
let b2: number;
|
||||||
let diff;
|
let diff: number;
|
||||||
|
|
||||||
for (; i < vcolors.length; i++) {
|
for (; i < vcolors.length; i++) {
|
||||||
c = vcolors[i];
|
c = vcolors[i];
|
||||||
@@ -2341,7 +2338,7 @@ function isThirdLevelShift(ev: KeyboardEvent): boolean {
|
|||||||
return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);
|
return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchColorCache = {};
|
const matchColorCache: {[colorRGBHash: number]: number} = {};
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/1633828
|
// http://stackoverflow.com/questions/1633828
|
||||||
const matchColorDistance = function(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number): number {
|
const matchColorDistance = function(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number): number {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export class MockInputHandlingTerminal implements IInputHandlingTerminal {
|
|||||||
setgLevel(g: number): void {
|
setgLevel(g: number): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
eraseAttr() {
|
eraseAttr(): number {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
eraseRight(x: number, y: number): void {
|
eraseRight(x: number, y: number): void {
|
||||||
@@ -149,7 +149,7 @@ export class MockInputHandlingTerminal implements IInputHandlingTerminal {
|
|||||||
refresh(start: number, end: number): void {
|
refresh(start: number, end: number): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
matchColor(r1: number, g1: number, b1: number) {
|
matchColor(r1: number, g1: number, b1: number): number {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
error(text: string, data?: any): void {
|
error(text: string, data?: any): void {
|
||||||
|
|||||||
-2389
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user