Fix screen scrolling when cursor is at bottom

This commit is contained in:
Joscha 2022-07-20 18:07:44 +02:00
parent 5210ad1eba
commit 613c57c1aa

View file

@ -48,7 +48,11 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
last_cursor_path: &Path<M::Id>, last_cursor_path: &Path<M::Id>,
size: Size, size: Size,
) -> i32 { ) -> i32 {
if let Some(block) = last_blocks.find(|b| cursor.matches_block(b)) { if matches!(cursor, Cursor::Bottom) {
// Ensures that a Cursor::Bottom is always at the bottom of the
// screen. Will be scroll-clamped to the bottom later.
0
} else if let Some(block) = last_blocks.find(|b| cursor.matches_block(b)) {
block.line block.line
} else if last_cursor_path < cursor_path { } else if last_cursor_path < cursor_path {
// If the cursor is bottom, the bottom marker needs to be located at // If the cursor is bottom, the bottom marker needs to be located at