Skip to content

Commit

Permalink
selection preservation off by 1, fix #1367
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed May 28, 2017
1 parent e54a07f commit 8765636
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,11 @@ function shiftRange(range, index, length, source) {
let start, end;
if (index instanceof Delta) {
[start, end] = [range.index, range.index + range.length].map(function(pos) {
return index.transformPosition(pos, source === Emitter.sources.USER);
return index.transformPosition(pos, source !== Emitter.sources.USER);
});
} else {
[start, end] = [range.index, range.index + range.length].map(function(pos) {
if (pos < index || (pos === index && source !== Emitter.sources.USER)) return pos;
if (pos < index || (pos === index && source === Emitter.sources.USER)) return pos;
if (length >= 0) {
return pos + length;
} else {
Expand Down

0 comments on commit 8765636

Please sign in to comment.