@@ -44,6 +44,7 @@ export class Terminal implements ITerminalApi {
|
|||||||
this._core.focus();
|
this._core.focus();
|
||||||
}
|
}
|
||||||
public resize(columns: number, rows: number): void {
|
public resize(columns: number, rows: number): void {
|
||||||
|
this._verifyIntegers(columns, rows);
|
||||||
this._core.resize(columns, rows);
|
this._core.resize(columns, rows);
|
||||||
}
|
}
|
||||||
public writeln(data: string): void {
|
public writeln(data: string): void {
|
||||||
@@ -74,12 +75,14 @@ export class Terminal implements ITerminalApi {
|
|||||||
this._core.deregisterCharacterJoiner(joinerId);
|
this._core.deregisterCharacterJoiner(joinerId);
|
||||||
}
|
}
|
||||||
public addMarker(cursorYOffset: number): IMarker {
|
public addMarker(cursorYOffset: number): IMarker {
|
||||||
|
this._verifyIntegers(cursorYOffset);
|
||||||
return this._core.addMarker(cursorYOffset);
|
return this._core.addMarker(cursorYOffset);
|
||||||
}
|
}
|
||||||
public hasSelection(): boolean {
|
public hasSelection(): boolean {
|
||||||
return this._core.hasSelection();
|
return this._core.hasSelection();
|
||||||
}
|
}
|
||||||
public select(column: number, row: number, length: number): void {
|
public select(column: number, row: number, length: number): void {
|
||||||
|
this._verifyIntegers(column, row, length);
|
||||||
this._core.select(column, row, length);
|
this._core.select(column, row, length);
|
||||||
}
|
}
|
||||||
public getSelection(): string {
|
public getSelection(): string {
|
||||||
@@ -95,6 +98,7 @@ export class Terminal implements ITerminalApi {
|
|||||||
this._core.selectAll();
|
this._core.selectAll();
|
||||||
}
|
}
|
||||||
public selectLines(start: number, end: number): void {
|
public selectLines(start: number, end: number): void {
|
||||||
|
this._verifyIntegers(start, end);
|
||||||
this._core.selectLines(start, end);
|
this._core.selectLines(start, end);
|
||||||
}
|
}
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
@@ -102,9 +106,11 @@ export class Terminal implements ITerminalApi {
|
|||||||
this._core.dispose();
|
this._core.dispose();
|
||||||
}
|
}
|
||||||
public scrollLines(amount: number): void {
|
public scrollLines(amount: number): void {
|
||||||
|
this._verifyIntegers(amount);
|
||||||
this._core.scrollLines(amount);
|
this._core.scrollLines(amount);
|
||||||
}
|
}
|
||||||
public scrollPages(pageCount: number): void {
|
public scrollPages(pageCount: number): void {
|
||||||
|
this._verifyIntegers(pageCount);
|
||||||
this._core.scrollPages(pageCount);
|
this._core.scrollPages(pageCount);
|
||||||
}
|
}
|
||||||
public scrollToTop(): void {
|
public scrollToTop(): void {
|
||||||
@@ -114,6 +120,7 @@ export class Terminal implements ITerminalApi {
|
|||||||
this._core.scrollToBottom();
|
this._core.scrollToBottom();
|
||||||
}
|
}
|
||||||
public scrollToLine(line: number): void {
|
public scrollToLine(line: number): void {
|
||||||
|
this._verifyIntegers(line);
|
||||||
this._core.scrollToLine(line);
|
this._core.scrollToLine(line);
|
||||||
}
|
}
|
||||||
public clear(): void {
|
public clear(): void {
|
||||||
@@ -149,6 +156,7 @@ export class Terminal implements ITerminalApi {
|
|||||||
this._core.optionsService.setOption(key, value);
|
this._core.optionsService.setOption(key, value);
|
||||||
}
|
}
|
||||||
public refresh(start: number, end: number): void {
|
public refresh(start: number, end: number): void {
|
||||||
|
this._verifyIntegers(start, end);
|
||||||
this._core.refresh(start, end);
|
this._core.refresh(start, end);
|
||||||
}
|
}
|
||||||
public reset(): void {
|
public reset(): void {
|
||||||
@@ -163,6 +171,14 @@ export class Terminal implements ITerminalApi {
|
|||||||
public static get strings(): ILocalizableStrings {
|
public static get strings(): ILocalizableStrings {
|
||||||
return Strings;
|
return Strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _verifyIntegers(...values: number[]): void {
|
||||||
|
values.forEach(value => {
|
||||||
|
if (value % 1 !== 0) {
|
||||||
|
throw new Error('This API does not accept floating point numbers');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BufferApiView implements IBufferApi {
|
class BufferApiView implements IBufferApi {
|
||||||
|
|||||||
Reference in New Issue
Block a user