From fc7cf6b917da5aec5f3b1dd8df07f3d5a6d9212b Mon Sep 17 00:00:00 2001 From: Bruno Ribeito Date: Tue, 7 Nov 2017 21:08:21 +0000 Subject: [PATCH] Adress feedback --- fixtures/typings-test/typings-test.ts | 2 ++ src/SelectionManager.ts | 3 ++- typings/xterm.d.ts | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fixtures/typings-test/typings-test.ts b/fixtures/typings-test/typings-test.ts index 9d73535e..93fd501f 100644 --- a/fixtures/typings-test/typings-test.ts +++ b/fixtures/typings-test/typings-test.ts @@ -64,6 +64,7 @@ namespace methods_core { t.on('blur', () => {}); t.on('focus', () => {}); t.on('lineFeed', () => {}); + t.on('selection', () => {}); // args t.on('data', () => {}); t.on('data', (data: string) => console.log(data)); @@ -89,6 +90,7 @@ namespace methods_core { t.off('blur', () => {}); t.off('focus', () => {}); t.off('lineFeed', () => {}); + t.off('selection', () => {}); // args t.off('data', () => {}); t.off('data', (data: string) => console.log(data)); diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index a5582478..387ce8d1 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -255,6 +255,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager public selectAll(): void { this._model.isSelectAllActive = true; this.refresh(); + this.emit('selection'); } /** @@ -543,7 +544,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager this._removeMouseDownListeners(); if (this.hasSelection) - this.emit('selectionended'); + this.emit('selection'); } /** diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 9ab61ce6..b0f5ac4d 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -218,7 +218,7 @@ declare module 'xterm' { * @param type The type of the event. * @param listener The listener. */ - on(type: 'blur' | 'focus' | 'lineFeed', listener: () => void): void; + on(type: 'blur' | 'focus' | 'lineFeed' | 'selection', listener: () => void): void; /** * Registers an event listener. * @param type The type of the event. @@ -273,7 +273,7 @@ declare module 'xterm' { * @param type The type of the event. * @param listener The listener. */ - off(type: 'blur' | 'focus' | 'lineFeed' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void; + off(type: 'blur' | 'focus' | 'lineFeed' | 'selection' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void; /** * Resizes the terminal.