From c8a719b64a41c80f626f3b5cce46d718dfea6fe6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 22 Jul 2019 10:49:40 -0700 Subject: [PATCH] Clear textarea when ^C or enter is pressed --- src/Terminal.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Terminal.ts b/src/Terminal.ts index 7f662903..952adb01 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1562,6 +1562,13 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp return true; } + // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers + // will announce deleted characters. This will not work 100% of the time but it should cover + // most scenarios. + if (result.key === C0.ETX || result.key === C0.CR) { + this.textarea.value = ''; + } + this._keyDownHandled = true; this._onKey.fire({ key: result.key, domEvent: event }); this.showCursor();