Skip to content

Commit ca66e40

Browse files
committed
Drop touching cursor selections even when selectionsMayTouch is true
So that you don't get inscrutable duplicate selections Closes codemirror#5636
1 parent 41e7ff5 commit ca66e40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/model/selection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function normalizeSelection(cm, ranges, primIndex) {
6969
for (let i = 1; i < ranges.length; i++) {
7070
let cur = ranges[i], prev = ranges[i - 1]
7171
let diff = cmp(prev.to(), cur.from())
72-
if (mayTouch ? diff > 0 : diff >= 0) {
72+
if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
7373
let from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
7474
let inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
7575
if (i <= primIndex) --primIndex

0 commit comments

Comments
 (0)