Skip to content

Commit

Permalink
Avoid firing beforeCursorEnter twice for cursor selection
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jun 6, 2022
1 parent 70572f1 commit ff35dd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/model/selection_updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function skipAtomicInSelection(doc, sel, bias, mayClear) {
let range = sel.ranges[i]
let old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
let newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
let newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
let newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear)
if (out || newAnchor != range.anchor || newHead != range.head) {
if (!out) out = sel.ranges.slice(0, i)
out[i] = new Range(newAnchor, newHead)
Expand Down

0 comments on commit ff35dd5

Please sign in to comment.