From 4405f5e1630a10b7015eabdd7d9416b688bb53b7 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 7 Jun 2017 13:48:12 -0700 Subject: [PATCH] Fix clearSelection in select all mode --- src/SelectionManager.ts | 8 ++------ src/SelectionModel.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 22eac8a4..4a72dd87 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -119,12 +119,9 @@ export class SelectionManager extends EventEmitter { * are enabled. */ public disable() { - this._model.selectionStart = null; - this._model.selectionEnd = null; - this.refresh(); + this.clearSelection(); this._buffer.off('trim', this._bufferTrimListener); this._rowContainer.removeEventListener('mousedown', this._mouseDownListener); - this._removeMouseDownListeners(); } /** @@ -193,8 +190,7 @@ export class SelectionManager extends EventEmitter { * Clears the current terminal selection. */ public clearSelection(): void { - this._model.selectionStart = null; - this._model.selectionEnd = null; + this._model.clearSelection(); this._removeMouseDownListeners(); this.refresh(); } diff --git a/src/SelectionModel.ts b/src/SelectionModel.ts index f1762e38..a7f0069f 100644 --- a/src/SelectionModel.ts +++ b/src/SelectionModel.ts @@ -32,6 +32,15 @@ export class SelectionModel { ) { } + /** + * Clears the current selection. + */ + public clearSelection(): void { + this.selectionStart = null; + this.selectionEnd = null; + this.isSelectAllActive = false; + } + /** * The final selection start, taking into consideration select all. */