Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Perform less comparisons in compareBufferPositions
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Scandurra committed May 10, 2017
1 parent 8b273ef commit b131c3b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/screen-line-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit b131c3b

Please sign in to comment.