Skip to content

Commit

Permalink
fix range having negative length
Browse files Browse the repository at this point in the history
when scroll.length() == 0
  • Loading branch information
jhchen committed May 8, 2017
1 parent 06760d6 commit 01e567e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ class Selection {
return index + blot.index(node, offset);
}
});
let start = Math.min(...indexes), end = Math.max(...indexes);
end = Math.min(end, this.scroll.length() - 1);
let end = Math.min(Math.max(...indexes), this.scroll.length() - 1);
let start = Math.min(end, ...indexes);
return new Range(start, end-start);
}

Expand Down

0 comments on commit 01e567e

Please sign in to comment.