Skip to content

Commit 86a87a2

Browse files
committed
[sublime bindings] Fix selectNextOccurrence to do nothing when all instances are selected
Closes codemirror#6024
1 parent f5d3554 commit 86a87a2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

keymap/sublime.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@
144144
cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));
145145
found = cur.findNext();
146146
}
147-
if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to()))
148-
return CodeMirror.Pass
147+
if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to())) return
149148
cm.addSelection(cur.from(), cur.to());
150149
}
151150
if (fullWord)
@@ -175,7 +174,8 @@
175174

176175
function isSelectedRange(ranges, from, to) {
177176
for (var i = 0; i < ranges.length; i++)
178-
if (ranges[i].from() == from && ranges[i].to() == to) return true
177+
if (CodeMirror.cmpPos(ranges[i].from(), from) == 0 &&
178+
CodeMirror.cmpPos(ranges[i].to(), to) == 0) return true
179179
return false
180180
}
181181

0 commit comments

Comments
 (0)