Skip to content

Commit

Permalink
[sublime bindings] Fix selectNextOccurrence to do nothing when all in…
Browse files Browse the repository at this point in the history
…stances are selected

Closes codemirror#6024
  • Loading branch information
marijnh authored and cone56 committed Jan 6, 2020
1 parent a462fe0 commit 1f42046
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions keymap/sublime.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@
cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));
found = cur.findNext();
}
if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to()))
return CodeMirror.Pass
if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to())) return
cm.addSelection(cur.from(), cur.to());
}
if (fullWord)
Expand Down Expand Up @@ -175,7 +174,8 @@

function isSelectedRange(ranges, from, to) {
for (var i = 0; i < ranges.length; i++)
if (ranges[i].from() == from && ranges[i].to() == to) return true
if (CodeMirror.cmpPos(ranges[i].from(), from) == 0 &&
CodeMirror.cmpPos(ranges[i].to(), to) == 0) return true
return false
}

Expand Down

0 comments on commit 1f42046

Please sign in to comment.