Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
bin: Streamline shortcuts
Erik Kundt committed 3 months ago
commit 7f8fd337b54d69578d4249fffffddfeb284fe308
parent 46c931c
3 files changed +34 -26
modified bin/apps/inbox/list.rs
@@ -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);
+
            },
        );
    }

modified bin/apps/issue/list.rs
@@ -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)?;

modified bin/apps/patch/list.rs
@@ -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);
+
            },
        );
    }