mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-15 16:00:38 +08:00
bin: Adjust patch select to new imUI focus interface
This commit is contained in:
@@ -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
@@ -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));
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user