bin: Adjust patch select to new imUI focus interface

This commit is contained in:
Erik Kundt
2024-10-02 21:43:38 +02:00
parent e96ee308de
commit b58d04ae33
2 changed files with 3 additions and 20 deletions
+2 -4
View File
@@ -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(),
+1 -16
View File
@@ -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));
}
},