minor: Import Range too

This commit is contained in:
Blaž Hrastnik 2021-11-15 00:12:14 +09:00
parent 35c974c9c4
commit 1817b7f581

View file

@ -1,4 +1,4 @@
use crate::{Assoc, ChangeSet, Rope, State, Transaction}; use crate::{Assoc, ChangeSet, Range, Rope, State, Transaction};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use std::num::NonZeroUsize; use std::num::NonZeroUsize;
@ -148,9 +148,7 @@ pub fn last_edit_pos(&self) -> Option<usize> {
.transaction .transaction
.changes_iter() .changes_iter()
// find a change that matches the primary selection // find a change that matches the primary selection
.find(|(from, to, _fragment)| { .find(|(from, to, _fragment)| Range::new(*from, *to).overlaps(&primary_selection))
crate::Range::new(*from, *to).overlaps(&primary_selection)
})
// or use the first change // or use the first change
.or_else(|| current_revision.transaction.changes_iter().next()) .or_else(|| current_revision.transaction.changes_iter().next())
.unwrap(); .unwrap();