Files
oak-gpui/zed/src/editor/mod.rs
T
Max BrunsfeldandAntonio Scandurra 510f20411a Get cursor movement working with byte columns
Introduce `clip_point` and `clip_offset` methods on `Rope`, `Buffer`, and `FoldMap`.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-05-20 12:47:08 +02:00

29 lines
545 B
Rust

mod buffer;
mod buffer_element;
pub mod buffer_view;
pub mod display_map;
pub mod movement;
pub use buffer::*;
pub use buffer_element::*;
pub use buffer_view::*;
pub use display_map::DisplayPoint;
use display_map::*;
use std::{cmp, ops::Range};
#[derive(Copy, Clone)]
pub enum Bias {
Left,
Right,
}
trait RangeExt<T> {
fn sorted(&self) -> Range<T>;
}
impl<T: Ord + Clone> RangeExt<T> for Range<T> {
fn sorted(&self) -> Self {
cmp::min(&self.start, &self.end).clone()..cmp::max(&self.start, &self.end).clone()
}
}