Move cursor in nick list

This commit is contained in:
Joscha 2022-09-25 22:22:20 +02:00
parent c16ad024ed
commit f109fd0d9b

View file

@ -23,7 +23,7 @@ use crate::ui::widgets::list::ListState;
use crate::ui::widgets::padding::Padding; use crate::ui::widgets::padding::Padding;
use crate::ui::widgets::text::Text; use crate::ui::widgets::text::Text;
use crate::ui::widgets::BoxedWidget; use crate::ui::widgets::BoxedWidget;
use crate::ui::UiEvent; use crate::ui::{util, UiEvent};
use crate::vault::EuphRoomVault; use crate::vault::EuphRoomVault;
use super::account::{self, AccountUiState}; use super::account::{self, AccountUiState};
@ -481,6 +481,20 @@ impl EuphRoom {
false false
} }
fn list_nick_list_focus_key_bindings(&self, bindings: &mut KeyBindingsList) {
util::list_list_key_bindings(bindings);
}
fn handle_nick_list_focus_input_event(&mut self, event: &InputEvent) -> bool {
if util::handle_list_input_event(&mut self.nick_list, event) {
return true;
}
// TODO Inspect users
false
}
pub async fn list_normal_key_bindings(&self, bindings: &mut KeyBindingsList) { pub async fn list_normal_key_bindings(&self, bindings: &mut KeyBindingsList) {
// Handled in rooms list, not here // Handled in rooms list, not here
// TODO Move to rooms list? // TODO Move to rooms list?
@ -498,6 +512,7 @@ impl EuphRoom {
} }
Focus::NickList => { Focus::NickList => {
bindings.binding("tab", "focus on chat"); bindings.binding("tab", "focus on chat");
self.list_nick_list_focus_key_bindings(bindings);
} }
} }
} }
@ -533,6 +548,10 @@ impl EuphRoom {
self.focus = Focus::Chat; self.focus = Focus::Chat;
return true; return true;
} }
if self.handle_nick_list_focus_input_event(event) {
return true;
}
} }
} }