Skip to content

Commit

Permalink
fix #891
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 29, 2016
1 parent b937203 commit 2f25680
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 @@ -195,10 +195,10 @@ class Selection {
let bounds = this.getBounds(range.index, range.length);
if (bounds == null) return;
if (this.root.offsetHeight < bounds.bottom) {
let [line, ] = this.scroll.line(range.index + range.length);
let [line, ] = this.scroll.line(Math.min(range.index + range.length, this.scroll.length()-1));
this.root.scrollTop = line.domNode.offsetTop + line.domNode.offsetHeight - this.root.offsetHeight;
} else if (bounds.top < 0) {
let [line, ] = this.scroll.line(range.index);
let [line, ] = this.scroll.line(Math.min(range.index, this.scroll.length()-1));
this.root.scrollTop = line.domNode.offsetTop;
}
}
Expand Down

0 comments on commit 2f25680

Please sign in to comment.