bin: Streamline shortcuts

This commit is contained in:
Erik Kundt
2026-01-22 13:31:58 +01:00
parent 46c931c4d8
commit 7f8fd337b5
3 changed files with 34 additions and 26 deletions
+16 -12
View File
@@ -106,7 +106,7 @@ impl Tui {
}
pub async fn run(&self) -> Result<Option<Selection>> {
let viewport = Viewport::Inline(20);
let viewport = Viewport::Fullscreen;
let channel = Channel::default();
let state = App::try_from(&self.context)?;
@@ -594,17 +594,21 @@ impl App {
}
pub fn show_browser_shortcuts(&self, frame: &mut Frame, ui: &mut Ui<Message>) {
ui.shortcuts(
frame,
&[
("enter", "show"),
("r", "reload"),
("c", "clear"),
("/", "search"),
("?", "help"),
],
'∙',
Alignment::Left,
let shortcuts = vec![
("/", "search"),
("enter", "show"),
("c", "clear"),
("r", "reload"),
];
let global_shortcuts = vec![("?", "help")];
ui.layout(
Layout::horizontal([Constraint::Fill(1), Constraint::Length(30)]),
None,
|ui| {
ui.shortcuts(frame, &shortcuts, '∙', Alignment::Left);
ui.shortcuts(frame, &global_shortcuts, '∙', Alignment::Right);
},
);
}
+1 -1
View File
@@ -145,7 +145,7 @@ impl Tui {
}
pub async fn run(&self) -> Result<Option<Selection>> {
let viewport = Viewport::Inline(20);
let viewport = Viewport::Fullscreen;
let channel = Channel::default();
let state = App::try_from(&self.context)?;
+17 -13
View File
@@ -179,7 +179,7 @@ impl Tui {
}
pub async fn run(&self) -> Result<Option<Selection>> {
let viewport = Viewport::Inline(20);
let viewport = Viewport::Fullscreen;
let channel = Channel::default();
let state = App::try_from(&self.context)?;
@@ -721,18 +721,22 @@ impl App {
}
pub fn show_browser_shortcuts(&self, frame: &mut Frame, ui: &mut Ui<Message>) {
ui.shortcuts(
frame,
&[
("enter", "show"),
("c", "checkout"),
("d", "diff"),
("/", "search"),
("r", "reload"),
("?", "help"),
],
'∙',
Alignment::Left,
let shortcuts = vec![
("/", "search"),
("enter", "show"),
("c", "checkout"),
("d", "diff"),
("r", "reload"),
];
let global_shortcuts = vec![("?", "help")];
ui.layout(
Layout::horizontal([Constraint::Fill(1), Constraint::Length(30)]),
None,
|ui| {
ui.shortcuts(frame, &shortcuts, '∙', Alignment::Left);
ui.shortcuts(frame, &global_shortcuts, '∙', Alignment::Right);
},
);
}