From 4d16c5e9e864b8953e66c5d1624c9b32167f0486 Mon Sep 17 00:00:00 2001 From: npezza93 Date: Wed, 27 Dec 2017 11:36:05 -0500 Subject: [PATCH 1/2] Move selection event emission to the terminal object --- src/SelectionManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 387ce8d1..0080c795 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -255,7 +255,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager public selectAll(): void { this._model.isSelectAllActive = true; this.refresh(); - this.emit('selection'); + this._terminal.emit('selection'); } /** @@ -544,7 +544,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager this._removeMouseDownListeners(); if (this.hasSelection) - this.emit('selection'); + this._terminal.emit('selection'); } /** From f65aeba68424bf026efb674c88104fb7355c8c58 Mon Sep 17 00:00:00 2001 From: npezza93 Date: Wed, 27 Dec 2017 13:24:03 -0500 Subject: [PATCH 2/2] Override MockTerminals emit to do nothing --- src/SelectionManager.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SelectionManager.test.ts b/src/SelectionManager.test.ts index 8c6ea3e1..a10dc669 100644 --- a/src/SelectionManager.test.ts +++ b/src/SelectionManager.test.ts @@ -14,6 +14,10 @@ import { BufferSet } from './BufferSet'; import { MockTerminal } from './utils/TestUtils.test'; import { LineData, CharData } from './Types'; +class TestMockTerminal extends MockTerminal { + emit(event: string, data: any): void {} +} + class TestSelectionManager extends SelectionManager { constructor( terminal: ITerminal, @@ -48,7 +52,7 @@ describe('SelectionManager', () => { dom = new jsdom.JSDOM(''); window = dom.window; document = window.document; - terminal = new MockTerminal(); + terminal = new TestMockTerminal(); terminal.cols = 80; terminal.rows = 2; terminal.options.scrollback = 100;