From b131c3bb726c1b3e702ec6d88b7ed7083c40f65c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 10 May 2017 16:05:29 +0200 Subject: [PATCH] Perform less comparisons in compareBufferPositions --- src/screen-line-builder.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/screen-line-builder.js b/src/screen-line-builder.js index b6a0b74c31..d09fe8d382 100644 --- a/src/screen-line-builder.js +++ b/src/screen-line-builder.js @@ -406,18 +406,7 @@ class ScreenLineBuilder { } compareBufferPosition (position) { - if (this.bufferRow < position.row) { - return -1 - } else if (this.bufferRow === position.row) { - if (this.bufferColumn < position.column) { - return -1 - } else if (this.bufferColumn === position.column) { - return 0 - } else { - return 1 - } - } else { - return 1 - } + const rowComparison = this.bufferRow - position.row + return rowComparison === 0 ? (this.bufferColumn - position.column) : rowComparison } }