Move cursor to new room in room list
This commit is contained in:
parent
bf11e055b6
commit
866176dab6
3 changed files with 8 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ Procedure when bumping the version number:
|
|||
### Updated
|
||||
|
||||
- Documentation for `time_zone` config option
|
||||
- When connecting to a room using `n` in the room list, the cursor now moves to that room
|
||||
|
||||
## v0.8.3 - 2024-05-20
|
||||
|
||||
|
|
|
|||
|
|
@ -589,6 +589,7 @@ impl Rooms {
|
|||
return true;
|
||||
}
|
||||
ConnectResult::Connect(room) => {
|
||||
self.list.move_cursor_to_id(&room);
|
||||
self.connect_to_room(room.clone()).await;
|
||||
self.state = State::ShowRoom(room);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -239,6 +239,12 @@ impl<Id: Clone + Eq> ListState<Id> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn move_cursor_to_id(&mut self, id: &Id) {
|
||||
if let Some(new_cursor) = self.selectable_of_id(id) {
|
||||
self.move_cursor_to(new_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
fn fix_cursor(&mut self) {
|
||||
let new_cursor = if let Some(cursor) = &self.cursor {
|
||||
self.selectable_of_id(&cursor.id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue