mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
@@ -24,7 +24,7 @@ export function createProgram(gl: WebGLRenderingContext, vertexSource: string, f
|
||||
return program;
|
||||
}
|
||||
|
||||
console.log(gl.getProgramInfoLog(program));
|
||||
console.error(gl.getProgramInfoLog(program));
|
||||
gl.deleteProgram(program);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function createShader(gl: WebGLRenderingContext, type: number, source: st
|
||||
return shader;
|
||||
}
|
||||
|
||||
console.log(gl.getShaderInfoLog(shader));
|
||||
console.error(gl.getShaderInfoLog(shader));
|
||||
gl.deleteShader(shader);
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ function initOptions(term: TerminalType): void {
|
||||
fontFamily: null,
|
||||
fontWeight: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
||||
fontWeightBold: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
||||
logLevel: ['debug', 'info', 'warn', 'error', 'off'],
|
||||
rendererType: ['dom', 'canvas'],
|
||||
wordSeparator: null
|
||||
};
|
||||
|
||||
+2
-2
@@ -324,7 +324,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
const cursorStartX = buffer.x;
|
||||
const cursorStartY = buffer.y;
|
||||
|
||||
this._logService.debug('data: ' + data);
|
||||
this._logService.debug('parsing data', data);
|
||||
|
||||
if (this._parseBuffer.length < data.length) {
|
||||
this._parseBuffer = new Uint32Array(data.length);
|
||||
@@ -348,7 +348,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
const cursorStartY = buffer.y;
|
||||
|
||||
// TODO: Consolidate debug/logging #1560
|
||||
this._logService.debug('data: ' + data);
|
||||
this._logService.debug('parsing data', data);
|
||||
|
||||
if (this._parseBuffer.length < data.length) {
|
||||
this._parseBuffer = new Uint32Array(data.length);
|
||||
|
||||
@@ -11,10 +11,11 @@ import { MockBuffer, MockTerminal, TestTerminal } from './TestUtils.test';
|
||||
import { CircularList } from 'common/CircularList';
|
||||
import { BufferLine } from 'common/buffer/BufferLine';
|
||||
import { CellData } from 'common/buffer/CellData';
|
||||
import { MockLogService } from 'common/TestUtils.test';
|
||||
|
||||
class TestLinkifier extends Linkifier {
|
||||
constructor(terminal: ITerminal) {
|
||||
super(terminal);
|
||||
super(terminal, new MockLogService());
|
||||
Linkifier._timeBeforeLatency = 0;
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -8,6 +8,7 @@ import { IBufferStringIteratorResult } from 'common/buffer/Types';
|
||||
import { MouseZone } from './MouseZoneManager';
|
||||
import { getStringCellWidth } from 'common/CharWidth';
|
||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||
import { ILogService } from 'common/services/Services';
|
||||
|
||||
/**
|
||||
* Limit of the unwrapping line expansion (overscan) at the top and bottom
|
||||
@@ -42,7 +43,8 @@ export class Linkifier implements ILinkifier {
|
||||
public get onLinkTooltip(): IEvent<ILinkifierEvent> { return this._onLinkTooltip.event; }
|
||||
|
||||
constructor(
|
||||
protected _terminal: ITerminal
|
||||
protected _terminal: ITerminal,
|
||||
private _logService: ILogService
|
||||
) {
|
||||
this._rowsToLinkify = {
|
||||
start: null,
|
||||
@@ -212,7 +214,7 @@ export class Linkifier implements ILinkifier {
|
||||
// since this is most likely a bug the regex itself we simply do nothing here
|
||||
// DEBUG: print match and throw
|
||||
if ((<any>this._terminal).debug) {
|
||||
console.log({match, matcher});
|
||||
this._logService.error({ match, matcher });
|
||||
throw new Error('match found without corresponding matchIndex');
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-22
@@ -88,7 +88,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
||||
* The HTMLElement that the terminal is created in, set by Terminal.open.
|
||||
*/
|
||||
private _parent: HTMLElement;
|
||||
private _context: Window;
|
||||
private _document: Document;
|
||||
private _viewportScrollArea: HTMLElement;
|
||||
private _viewportElement: HTMLElement;
|
||||
@@ -306,7 +305,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
||||
this.register(this._inputHandler);
|
||||
|
||||
this._selectionService = this._selectionService || null;
|
||||
this.linkifier = this.linkifier || new Linkifier(this);
|
||||
this.linkifier = this.linkifier || new Linkifier(this, this._logService);
|
||||
this._mouseZoneManager = this._mouseZoneManager || null;
|
||||
|
||||
if (this.options.windowsMode) {
|
||||
@@ -537,8 +536,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
||||
throw new Error('Terminal requires a parent element.');
|
||||
}
|
||||
|
||||
// Grab global elements
|
||||
this._context = this._parent.ownerDocument.defaultView;
|
||||
this._document = this._parent.ownerDocument;
|
||||
|
||||
// Create main element container
|
||||
@@ -1679,24 +1676,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the current state to the console.
|
||||
*/
|
||||
public log(text: string, data?: any): void {
|
||||
if (!this.options.debug) return;
|
||||
if (!this._context.console || !this._context.console.log) return;
|
||||
this._context.console.log(text, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the current state as error to the console.
|
||||
*/
|
||||
public error(text: string, data?: any): void {
|
||||
if (!this.options.debug) return;
|
||||
if (!this._context.console || !this._context.console.error) return;
|
||||
this._context.console.error(text, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the terminal.
|
||||
*
|
||||
|
||||
Vendored
-3
@@ -65,11 +65,9 @@ export interface IInputHandlingTerminal {
|
||||
is(term: string): boolean;
|
||||
setgCharset(g: number, charset: ICharset): void;
|
||||
resize(x: number, y: number): void;
|
||||
log(text: string, data?: any): void;
|
||||
reset(): void;
|
||||
showCursor(): void;
|
||||
refresh(start: number, end: number): void;
|
||||
error(text: string, data?: any): void;
|
||||
handleTitle(title: string): void;
|
||||
}
|
||||
|
||||
@@ -212,7 +210,6 @@ export interface ITerminal extends IPublicTerminal, IElementAccessor, IBufferAcc
|
||||
|
||||
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
||||
cancel(ev: Event, force?: boolean): boolean | void;
|
||||
log(text: string): void;
|
||||
showCursor(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
import { MockCharSizeService, MockMouseService } from 'browser/TestUtils.test';
|
||||
import { CellData } from 'common/buffer/CellData';
|
||||
import { IBuffer } from 'common/buffer/Types';
|
||||
import { isWindows } from 'common/Platform';
|
||||
|
||||
class TestSelectionService extends SelectionService {
|
||||
constructor(
|
||||
@@ -360,8 +359,6 @@ describe('SelectionService', () => {
|
||||
buffer.lines.set(3, stringToRow('4'));
|
||||
buffer.lines.set(4, stringToRow('5'));
|
||||
selectionService.selectAll();
|
||||
console.log(selectionService.selectionText.length);
|
||||
console.log(isWindows);
|
||||
assert.equal(selectionService.selectionText, '1\n2\n3\n4\n5');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,25 +54,25 @@ export class LogService implements ILogService {
|
||||
|
||||
debug(message: any, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.Debug) {
|
||||
console.log.call(console, message, optionalParams);
|
||||
console.log.call(console, message, ...optionalParams);
|
||||
}
|
||||
}
|
||||
|
||||
info(message: any, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.Info) {
|
||||
console.info.call(console, message, optionalParams);
|
||||
console.info.call(console, message, ...optionalParams);
|
||||
}
|
||||
}
|
||||
|
||||
warn(message: any, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.Warn) {
|
||||
console.warn.call(console, message, optionalParams);
|
||||
console.warn.call(console, message, ...optionalParams);
|
||||
}
|
||||
}
|
||||
|
||||
error(message: any, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.Error) {
|
||||
console.error.call(console, message, optionalParams);
|
||||
console.error.call(console, message, ...optionalParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user