Fix chat scrolling up after sending message
This commit is contained in:
parent
21bb87fd45
commit
3f18b76c7d
2 changed files with 7 additions and 0 deletions
|
|
@ -124,6 +124,7 @@ impl<M: Msg, S: MsgStore<M>> ChatState<M, S> {
|
||||||
/// A [`Reaction::Composed`] message was sent successfully.
|
/// A [`Reaction::Composed`] message was sent successfully.
|
||||||
pub fn send_successful(&mut self, id: M::Id) {
|
pub fn send_successful(&mut self, id: M::Id) {
|
||||||
if let Cursor::Pseudo { .. } = &self.cursor {
|
if let Cursor::Pseudo { .. } = &self.cursor {
|
||||||
|
self.tree.send_successful(&id);
|
||||||
self.cursor = Cursor::Msg(id);
|
self.cursor = Cursor::Msg(id);
|
||||||
self.editor.clear();
|
self.editor.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -405,6 +405,12 @@ impl<M: Msg, S: MsgStore<M>> TreeViewState<M, S> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn send_successful(&mut self, id: &M::Id) {
|
||||||
|
if let Cursor::Pseudo { .. } = self.last_cursor {
|
||||||
|
self.last_cursor = Cursor::Msg(id.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn widget<'a>(
|
pub fn widget<'a>(
|
||||||
&'a mut self,
|
&'a mut self,
|
||||||
cursor: &'a mut Cursor<M::Id>,
|
cursor: &'a mut Cursor<M::Id>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue