Start implementing proper cursor movement
This commit is contained in:
parent
bec12917d6
commit
ea6b345fa9
5 changed files with 148 additions and 46 deletions
|
|
@ -112,12 +112,12 @@ impl<I: PartialEq> Blocks<I> {
|
|||
if &block.id == id {
|
||||
block.cursor = true;
|
||||
if cursor.is_some() {
|
||||
panic!("more than one cursor in layout");
|
||||
panic!("more than one cursor in blocks");
|
||||
}
|
||||
cursor = Some(i);
|
||||
}
|
||||
}
|
||||
cursor.expect("no cursor in layout")
|
||||
cursor.expect("no cursor in blocks")
|
||||
}
|
||||
|
||||
pub fn calculate_offsets_with_cursor(&mut self, cursor: &Cursor<I>, height: u16) {
|
||||
|
|
@ -165,4 +165,8 @@ impl<I: PartialEq> Blocks<I> {
|
|||
self.push_back(block);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find(&self, id: &I) -> Option<&Block<I>> {
|
||||
self.blocks.iter().find(|b| &b.id == id)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue