diff --git a/core/selection.js b/core/selection.js index d08da8f1e1..c26079c5d3 100644 --- a/core/selection.js +++ b/core/selection.js @@ -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); }