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:
Joscha 2022-08-01 22:53:28 +02:00
parent 816bf5be1c
commit 781655c41b

View file

@ -114,13 +114,17 @@ 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);
// TODO Render proper editor or pseudocursor }
let block = Block::new(frame, BlockId::Cursor, Text::new("TODO")); Cursor::Editor { parent: None, .. } | Cursor::Pseudo { parent: None, .. } => {
blocks.blocks_mut().push_back(block); // TODO Render proper editor or pseudocursor
let block = Block::new(frame, BlockId::Cursor, Text::new("TODO"));
blocks.blocks_mut().push_back(block);
}
_ => {}
} }
blocks blocks