From e88a9ffd89556cd41b10b22fb7c4cdbd78ed87a6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 7 Jun 2017 19:17:38 -0700 Subject: [PATCH] Fix bug when selection end is less than start --- src/SelectionManager.test.ts | 11 ----------- src/SelectionModel.test.ts | 4 ---- src/SelectionModel.ts | 3 --- 3 files changed, 18 deletions(-) diff --git a/src/SelectionManager.test.ts b/src/SelectionManager.test.ts index 70eba55b..e0ff6789 100644 --- a/src/SelectionManager.test.ts +++ b/src/SelectionManager.test.ts @@ -166,15 +166,4 @@ describe('SelectionManager', () => { assert.equal(selectionManager.selectionText, '1\n2\n3\n4\n5'); }); }); - - describe('selectionText', () => { - it('should return the empty string when start or end selections are not set', () => { - assert.equal(selectionManager.selectionText, ''); - selectionManager.model.selectionStart = [0, 0]; - assert.equal(selectionManager.selectionText, ''); - selectionManager.model.selectionStart = null; - selectionManager.model.selectionEnd = [0, 0]; - assert.equal(selectionManager.selectionText, ''); - }); - }); }); diff --git a/src/SelectionModel.test.ts b/src/SelectionModel.test.ts index 489ac8c7..e8629596 100644 --- a/src/SelectionModel.test.ts +++ b/src/SelectionModel.test.ts @@ -106,10 +106,6 @@ describe('SelectionManager', () => { model.selectionEnd = [1, 2]; assert.equal(model.finalSelectionEnd, null); }); - it('should return null if there is no selection end or selection start length', () => { - model.selectionStart = [1, 2]; - assert.equal(model.finalSelectionEnd, null); - }); it('should return selection start + length if there is no selection end', () => { model.selectionStart = [2, 2]; model.selectionStartLength = 2; diff --git a/src/SelectionModel.ts b/src/SelectionModel.ts index fc5e5139..57eb51d4 100644 --- a/src/SelectionModel.ts +++ b/src/SelectionModel.ts @@ -73,9 +73,6 @@ export class SelectionModel { // Use the selection start if the end doesn't exist or they're reversed if (!this.selectionEnd || this._areSelectionValuesReversed()) { - if (this.selectionStartLength === 0) { - return null; - } return [this.selectionStart[0] + this.selectionStartLength, this.selectionStart[1]]; }