aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/text_annotations.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/helix-core/src/text_annotations.rs b/helix-core/src/text_annotations.rs
index 3e48de4d..e6093184 100644
--- a/helix-core/src/text_annotations.rs
+++ b/helix-core/src/text_annotations.rs
@@ -1,5 +1,4 @@
use std::cell::Cell;
-use std::convert::identity;
use std::ops::Range;
use std::rc::Rc;
@@ -113,9 +112,7 @@ impl<A, M> Layer<A, M> {
pub fn reset_pos(&self, char_idx: usize, get_char_idx: impl Fn(&A) -> usize) {
let new_index = self
.annotations
- .binary_search_by_key(&char_idx, get_char_idx)
- .unwrap_or_else(identity);
-
+ .partition_point(|annot| get_char_idx(annot) < char_idx);
self.current_index.set(new_index);
}