Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
lib: Improve shortcuts imUI widget
Erik Kundt committed 1 year ago
commit 9c9fdb0ba7feb2129ee9b57d403e5cbeb6bec82c
parent 672f2e1d1fbfdb5125415471f3c5f6aa409ef5e2
1 file changed +6 -3
modified src/ui/im.rs
@@ -412,7 +412,7 @@ impl Ui {
    pub fn shortcuts(
        &mut self,
        frame: &mut Frame,
-
        shortcuts: &[(String, String)],
+
        shortcuts: &[(&str, &str)],
        divider: char,
    ) -> Response {
        widget::Shortcuts::new(shortcuts, divider).ui(self, frame)
@@ -1379,9 +1379,12 @@ pub mod widget {
    }

    impl Shortcuts {
-
        pub fn new(shortcuts: &[(String, String)], divider: char) -> Self {
+
        pub fn new(shortcuts: &[(&str, &str)], divider: char) -> Self {
            Self {
-
                shortcuts: shortcuts.to_vec(),
+
                shortcuts: shortcuts
+
                    .iter()
+
                    .map(|(s, a)| (s.to_string(), a.to_string()))
+
                    .collect(),
                divider,
            }
        }