Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin: Adjust patch select to new imUI focus interface
Erik Kundt committed 1 year ago
commit b58d04ae33cbd26075184cb9aaa555ec215447ac
parent e96ee308de904aedb85c62435def3db0dfb9d3f9
2 files changed +3 -20
modified bin/commands/patch/select/imui.rs
@@ -256,7 +256,7 @@ impl<'a> Show<Message<'a>> for App<'a> {
                            if show_search {
                                self.show_search_text_edit(frame, ui);
                            } else {
-
                                ui.layout(Layout::vertical([1, 1]), |ui| {
+
                                ui.layout(Layout::vertical([1, 1]), None, |ui| {
                                    ui.bar(
                                        frame,
                                        match group_focus {
@@ -319,15 +319,13 @@ impl<'a> Show<Message<'a>> for App<'a> {
                        Constraint::Length(1),
                    ]);

-
                    ui.layout(layout, |ui| {
-
                        ui.set_focus(Some(0));
+
                    ui.composite(layout, 1, |ui| {
                        ui.columns(
                            frame,
                            [Column::new(Span::raw(" Help ").bold(), Constraint::Fill(1))].to_vec(),
                            Some(Borders::Top),
                        );

-
                        ui.set_focus(Some(1));
                        let text_view = ui.text_view(
                            frame,
                            self.help.text().to_string(),
modified bin/ui/im.rs
@@ -114,8 +114,6 @@ where
        M: Clone,
    {
        let mut response = Response::default();
-

-
        let (_, has_focus) = ui.current_area().unwrap_or_default();
        let (mut text, mut cursor) = (self.search.read().text, self.search.read().cursor);

        ui.layout(
@@ -124,17 +122,10 @@ where
                Constraint::Min(1),
                Constraint::Length(if *self.show_search { 2 } else { 3 }),
            ]),
+
            Some(1),
            |ui| {
-
                // TODO(erikli): Find better solution for border focus workaround or improve
-
                // interface for manually advancing / setting the focus index.
-
                if has_focus && !*self.show_search {
-
                    ui.set_focus(Some(0));
-
                }
                ui.columns(frame, self.header.clone().to_vec(), Some(Borders::Top));

-
                if has_focus && !*self.show_search {
-
                    ui.set_focus(Some(1));
-
                }
                let table = ui.table(
                    frame,
                    self.selected,
@@ -149,9 +140,6 @@ where
                response.changed |= table.changed;

                if *self.show_search {
-
                    if has_focus {
-
                        ui.set_focus(Some(2));
-
                    }
                    let text_edit = ui.text_edit_labeled_singleline(
                        frame,
                        &mut text,
@@ -162,9 +150,6 @@ where
                    self.search.write(TextEditState { text, cursor });
                    response.changed |= text_edit.changed;
                } else {
-
                    if has_focus {
-
                        ui.set_focus(Some(2));
-
                    }
                    ui.columns(frame, self.footer.clone().to_vec(), Some(Borders::Bottom));
                }
            },