diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 6ee081d2..3ec2aaf3 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -107,18 +107,7 @@ export class InputHandler implements IInputHandler { * Bell (Ctrl-G). */ public bell(): void { - this._terminal.emit('bell'); - if (this._terminal.bellSound) { - this._terminal.bellAudioElement.play(); - } - if (!this._terminal.visualBell) { - return; - } - this._terminal.element.style.borderColor = 'white'; - setTimeout(() => this._terminal.element.style.borderColor = '', 10); - if (this._terminal.options.popOnBell) { - this._terminal.focus(); - } + this._terminal.bell(); } /** diff --git a/src/Interfaces.ts b/src/Interfaces.ts index 9ab16c3c..22531fa3 100644 --- a/src/Interfaces.ts +++ b/src/Interfaces.ts @@ -87,6 +87,7 @@ export interface IInputHandlingTerminal extends IEventEmitter { viewport: IViewport; selectionManager: ISelectionManager; + bell(): void; focus(): void; convertEol: boolean; updateRange(y: number): void; diff --git a/src/Terminal.ts b/src/Terminal.ts index d344a964..7e3b9a2d 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1882,9 +1882,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT */ public bell(): void { this.emit('bell'); - if (this.soundBell()) { - this.bellAudioElement.play(); - } + if (this.soundBell()) this.bellAudioElement.play(); + if (this.visualBell()) { this.element.classList.add('visual-bell-active'); clearTimeout(this.visualBellTimer); diff --git a/src/utils/TestUtils.test.ts b/src/utils/TestUtils.test.ts index 8e18c1f4..8d475560 100644 --- a/src/utils/TestUtils.test.ts +++ b/src/utils/TestUtils.test.ts @@ -97,6 +97,10 @@ export class MockInputHandlingTerminal implements IInputHandlingTerminal { throw new Error('Method not implemented.'); } convertEol: boolean; + bell(): void { + throw new Error('Method not implemented.'); + } + updateRange(y: number): void { throw new Error('Method not implemented.'); }