From dce6e31c89531c3345e4f4fd56acdc7484fa9a63 Mon Sep 17 00:00:00 2001 From: arencoskun Date: Fri, 2 Feb 2024 08:59:57 +0300 Subject: [PATCH] Add headless definitons --- src/headless/Terminal.ts | 13 +++++++++++++ src/headless/public/Terminal.ts | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/headless/Terminal.ts b/src/headless/Terminal.ts index 18000c8f..c1e4950f 100644 --- a/src/headless/Terminal.ts +++ b/src/headless/Terminal.ts @@ -81,6 +81,19 @@ export class Terminal extends CoreTerminal { this._onBell.fire(); } + /** + * 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); + } + /** * Resizes the terminal. * diff --git a/src/headless/public/Terminal.ts b/src/headless/public/Terminal.ts index df202660..0d73f9d3 100644 --- a/src/headless/public/Terminal.ts +++ b/src/headless/public/Terminal.ts @@ -134,6 +134,9 @@ export class Terminal extends Disposable implements ITerminalApi { this._publicOptions[propName] = options[propName]; } } + public input(data: string, wasUserInput: boolean = true): void { + this._core.input(data, wasUserInput); + } public resize(columns: number, rows: number): void { this._verifyIntegers(columns, rows); this._core.resize(columns, rows);