Clip scroll_top_row before navigating back to it

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-04-27 16:11:42 +02:00
parent 27e693d8f7
commit cde5a45318
8 changed files with 88 additions and 35 deletions

View file

@ -9,6 +9,7 @@ pub struct Anchor {
pub timestamp: clock::Local,
pub offset: usize,
pub bias: Bias,
pub buffer_id: Option<u64>,
}
impl Anchor {
@ -16,12 +17,14 @@ impl Anchor {
timestamp: clock::Local::MIN,
offset: usize::MIN,
bias: Bias::Left,
buffer_id: None,
};
pub const MAX: Self = Self {
timestamp: clock::Local::MAX,
offset: usize::MAX,
bias: Bias::Right,
buffer_id: None,
};
pub fn cmp(&self, other: &Anchor, buffer: &BufferSnapshot) -> Ordering {