mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-05 14:35:20 -04:00
refactor(multiverse): Move some global shortcuts behind modifiers
This commit is contained in:
@@ -339,33 +339,31 @@ impl App {
|
||||
(KeyModifiers::NONE, F(10)) => self.set_global_mode(GlobalMode::Recovery {
|
||||
state: RecoveryViewState::new(self.client.clone()),
|
||||
}),
|
||||
(KeyModifiers::CONTROL, Char('j') | Down) => {
|
||||
self.room_list.next_room();
|
||||
let room_id = self.room_list.get_selected_room_id();
|
||||
self.room_view.set_selected_room(room_id);
|
||||
}
|
||||
(KeyModifiers::CONTROL, Char('k') | Up) => {
|
||||
self.room_list.previous_room();
|
||||
let room_id = self.room_list.get_selected_room_id();
|
||||
self.room_view.set_selected_room(room_id);
|
||||
}
|
||||
(KeyModifiers::CONTROL, Char('q')) => {
|
||||
if !matches!(self.state.global_mode, GlobalMode::Default) {
|
||||
self.set_global_mode(GlobalMode::Default);
|
||||
} else {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
_ => (),
|
||||
}
|
||||
|
||||
if key.kind == KeyEventKind::Press && key.modifiers == KeyModifiers::NONE {
|
||||
match key.code {
|
||||
Char('q') | Esc => {
|
||||
if !matches!(self.state.global_mode, GlobalMode::Default) {
|
||||
self.set_global_mode(GlobalMode::Default);
|
||||
} else {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
Char('j') | Down => {
|
||||
self.room_list.next_room();
|
||||
let room_id = self.room_list.get_selected_room_id();
|
||||
self.room_view.set_selected_room(room_id);
|
||||
}
|
||||
|
||||
Char('k') | Up => {
|
||||
self.room_list.previous_room();
|
||||
let room_id = self.room_list.get_selected_room_id();
|
||||
self.room_view.set_selected_room(room_id);
|
||||
}
|
||||
|
||||
Char('s') => self.sync_service.start().await,
|
||||
|
||||
Char('S') => self.sync_service.stop().await,
|
||||
|
||||
Char('Q') => {
|
||||
|
||||
@@ -23,6 +23,15 @@ impl Widget for &mut HelpView {
|
||||
let rows = vec![
|
||||
Row::new(vec![Cell::from("F1"), Cell::from("Open Help")]),
|
||||
Row::new(vec![Cell::from("F10"), Cell::from("Open the encryption settings")]),
|
||||
Row::new(vec![Cell::from("Ctrl-q"), Cell::from("Quit Multiverse")]),
|
||||
Row::new(vec![
|
||||
Cell::from("Ctrl-j / Ctrl-down"),
|
||||
Cell::from("Switch to the next room in the list"),
|
||||
]),
|
||||
Row::new(vec![
|
||||
Cell::from("Ctrl-k / Ctrl-up"),
|
||||
Cell::from("Switch to the previous room in the list"),
|
||||
]),
|
||||
Row::new(vec![Cell::from("s"), Cell::from("Resume syncing")]),
|
||||
Row::new(vec![Cell::from("S"), Cell::from("Stop syncing")]),
|
||||
Row::new(vec![Cell::from("Q"), Cell::from("Enable/disable the send queue")]),
|
||||
@@ -36,7 +45,7 @@ impl Widget for &mut HelpView {
|
||||
|
||||
let help_table = Table::new(rows, widths)
|
||||
.block(block)
|
||||
.widths(&[Constraint::Length(10), Constraint::Min(30)]);
|
||||
.widths(&[Constraint::Length(20), Constraint::Min(30)]);
|
||||
|
||||
StatefulWidget::render(help_table, area, buf, &mut TableState::default());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct Status {
|
||||
/// message.
|
||||
message_sender: mpsc::Sender<String>,
|
||||
|
||||
/// The task listening for messages to be received over the
|
||||
/// The task listening for status messages to be received over the
|
||||
/// [mpsc::Receiver].
|
||||
_receiver_task: JoinHandle<()>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user