Center cursor with z
This commit is contained in:
parent
dc0c56d759
commit
1113c197f7
1 changed files with 7 additions and 0 deletions
|
|
@ -405,6 +405,12 @@ impl<M: Msg> TreeView<M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn center_cursor(&mut self, cursor: &mut Option<Cursor<M::Id>>) {
|
||||||
|
if let Some(cursor) = cursor {
|
||||||
|
cursor.proportion = 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn handle_key_event<S: MsgStore<M>>(
|
pub async fn handle_key_event<S: MsgStore<M>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
store: &mut S,
|
store: &mut S,
|
||||||
|
|
@ -416,6 +422,7 @@ impl<M: Msg> TreeView<M> {
|
||||||
) {
|
) {
|
||||||
match event.code {
|
match event.code {
|
||||||
KeyCode::Char('k') => self.move_to_prev_msg(store, room, cursor).await,
|
KeyCode::Char('k') => self.move_to_prev_msg(store, room, cursor).await,
|
||||||
|
KeyCode::Char('z') => self.center_cursor(cursor).await,
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue