From da22b0308ef6f53f62f5eb78b19fce735aa1a15f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:00:05 -0800 Subject: [PATCH] Make textarea readonly when disableStdin is set Fixes #5256 --- src/browser/CoreBrowserTerminal.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/browser/CoreBrowserTerminal.ts b/src/browser/CoreBrowserTerminal.ts index 2e15b5f379..58da93445e 100644 --- a/src/browser/CoreBrowserTerminal.ts +++ b/src/browser/CoreBrowserTerminal.ts @@ -437,7 +437,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { this.screenElement.appendChild(this._helperContainer); fragment.appendChild(this.screenElement); - this.textarea = this._document.createElement('textarea'); + const textarea = this.textarea = this._document.createElement('textarea'); this.textarea.classList.add('xterm-helper-textarea'); this.textarea.setAttribute('aria-label', Strings.promptLabel.get()); if (!Browser.isChromeOS) { @@ -449,6 +449,8 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { this.textarea.setAttribute('autocapitalize', 'off'); this.textarea.setAttribute('spellcheck', 'false'); this.textarea.tabIndex = 0; + this._register(this.optionsService.onSpecificOptionChange('disableStdin', () => textarea.readOnly = this.optionsService.rawOptions.disableStdin)); + this.textarea.readOnly = this.optionsService.rawOptions.disableStdin; // Register the core browser service before the generic textarea handlers are registered so it // handles them first. Otherwise the renderers may use the wrong focus state.