Fix initial scroll at bottom not moving screen
When pressing ctrl+y while cursor = Cursor::Bottom, the screen would not scroll. Instead, the cursor would only jump to the lowest message on the screen. This was caused because the blocks were re-layouted after scrolling, starting from the Cursor::Bottom, thus resetting the scroll to the bottom of the screen.
This commit is contained in:
parent
816bf5be1c
commit
781655c41b
1 changed files with 11 additions and 7 deletions
|
|
@ -114,14 +114,18 @@ impl<M: Msg + ChatMsg, S: MsgStore<M>> InnerTreeViewState<M, S> {
|
||||||
blocks.blocks_mut().push_back(block);
|
blocks.blocks_mut().push_back(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor or pseudomessage
|
match self.cursor {
|
||||||
if let Cursor::Editor { parent: None, .. } | Cursor::Pseudo { parent: None, .. } =
|
Cursor::Bottom => {
|
||||||
self.cursor
|
let block = Block::new(frame, BlockId::Cursor, Empty);
|
||||||
{
|
blocks.blocks_mut().push_back(block);
|
||||||
|
}
|
||||||
|
Cursor::Editor { parent: None, .. } | Cursor::Pseudo { parent: None, .. } => {
|
||||||
// TODO Render proper editor or pseudocursor
|
// TODO Render proper editor or pseudocursor
|
||||||
let block = Block::new(frame, BlockId::Cursor, Text::new("TODO"));
|
let block = Block::new(frame, BlockId::Cursor, Text::new("TODO"));
|
||||||
blocks.blocks_mut().push_back(block);
|
blocks.blocks_mut().push_back(block);
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
blocks
|
blocks
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue