Set nick and join room
While entering a nick and while present, events seem to get swallowed by the room. I'll need to rethink my event handling strategy and key bindings. For the key bindings, I'll either need global bindings that don't interfere with text boxes, or I'll need modal editing or something similar where pressing ESC enough brings you back to the global focus. Global key bindings are things like switching rooms and quitting.
This commit is contained in:
parent
32959cf691
commit
168acbf6dc
4 changed files with 54 additions and 17 deletions
|
|
@ -267,11 +267,14 @@ impl Ui {
|
|||
event: KeyEvent,
|
||||
) -> Option<EventHandleResult> {
|
||||
match &self.room {
|
||||
Some(RoomId::Cove(name)) => self
|
||||
.cove_rooms
|
||||
.get_mut(name)
|
||||
.and_then(|ui| ui.handle_key(event))
|
||||
.and(Some(EventHandleResult::Continue)),
|
||||
Some(RoomId::Cove(name)) => {
|
||||
if let Some(ui) = self.cove_rooms.get_mut(name) {
|
||||
ui.handle_key(event).await;
|
||||
Some(EventHandleResult::Continue)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue