Get the Editor crate compiling

This commit is contained in:
Max Brunsfeld 2021-10-28 15:42:24 -07:00
parent 9c74be3bf2
commit efc85d1b75
3 changed files with 425 additions and 491 deletions

View file

@ -185,6 +185,16 @@ impl<T: Debug> Debug for AnchorRangeMap<T> {
} }
} }
impl Debug for AnchorRangeSet {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut f = f.debug_set();
for (range, _) in &self.0.entries {
f.entry(range);
}
f.finish()
}
}
impl AnchorRangeSet { impl AnchorRangeSet {
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.0.len() self.0.len()

View file

@ -37,6 +37,10 @@ pub struct SelectionState {
} }
impl<T: ToOffset + ToPoint + Copy + Ord> Selection<T> { impl<T: ToOffset + ToPoint + Copy + Ord> Selection<T> {
pub fn is_empty(&self) -> bool {
self.start == self.end
}
pub fn head(&self) -> T { pub fn head(&self) -> T {
if self.reversed { if self.reversed {
self.start self.start

File diff suppressed because it is too large Load diff