Scroll with ctrl+e and ctrl+d

This commit is contained in:
Joscha 2022-07-31 23:09:39 +02:00
parent d23d7b155c
commit cb2fc22c5a
3 changed files with 28 additions and 5 deletions

View file

@ -223,6 +223,23 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
// Not really necessary; only here for consistency with other methods
self.make_cursor_visible = true;
}
pub async fn scroll_up(&mut self, amount: i32) {
self.scroll += amount;
if let Cursor::Bottom = self.cursor {
// Move cursor to bottommost message, if it exists
if let Some(mut id) = self.store.last_tree_id().await {
let tree = self.store.tree(&id).await;
while Self::find_last_child(&tree, &mut id) {}
self.cursor = Cursor::Msg(id);
}
}
}
pub fn scroll_down(&mut self, amount: i32) {
self.scroll -= amount;
}
}
/*