Move function to CoreTerminal, add additional argument to specify if the input was user input or not.
This commit is contained in:
@@ -1192,16 +1192,6 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Input data to application side.
|
||||
* The data is treated the same way as typed input at the terminal.
|
||||
* (will appear in the onData event).
|
||||
*/
|
||||
public input(data: string): void {
|
||||
this.coreService.triggerDataEvent(data, true);
|
||||
this.write(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the terminal.
|
||||
*
|
||||
|
||||
@@ -72,7 +72,7 @@ export class MockTerminal implements ITerminal {
|
||||
public focus(): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
public input(data: string): void {
|
||||
public input(data: string, wasUserInput: boolean = true): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
public resize(columns: number, rows: number): void {
|
||||
|
||||
@@ -138,8 +138,8 @@ export class Terminal extends Disposable implements ITerminalApi {
|
||||
public focus(): void {
|
||||
this._core.focus();
|
||||
}
|
||||
public input(data: string): void {
|
||||
this._core.input(data);
|
||||
public input(data: string, wasUserInput: boolean = true): void {
|
||||
this._core.input(data, wasUserInput);
|
||||
}
|
||||
public resize(columns: number, rows: number): void {
|
||||
this._verifyIntegers(columns, rows);
|
||||
|
||||
@@ -168,6 +168,19 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
||||
this._writeBuffer.writeSync(data, maxSubsequentCalls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Input data to application side.
|
||||
* The data is treated the same way as typed input at the terminal.
|
||||
* (will appear in the onData event).
|
||||
* wasUserInput indicates, whether the input is genuine user input.
|
||||
* It is true by default and triggers additional actions like prompt focus or selection clearing.
|
||||
* Set it to false if your data sent does not resemble what a user would have typed
|
||||
* (e.g. sequence embedded data).
|
||||
*/
|
||||
public input(data: string, wasUserInput: boolean = true): void {
|
||||
this.coreService.triggerDataEvent(data, wasUserInput);
|
||||
}
|
||||
|
||||
public resize(x: number, y: number): void {
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user