mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-21 02:20:48 +08:00
lib: Various widget naming improvements
This commit is contained in:
@@ -536,7 +536,7 @@ impl App {
|
||||
}
|
||||
};
|
||||
|
||||
ui.bar(frame, context, Some(Borders::None));
|
||||
ui.column_bar(frame, context, Some(Borders::None));
|
||||
}
|
||||
|
||||
pub fn show_browser_shortcuts(&self, frame: &mut Frame, ui: &mut im::Ui<Message>) {
|
||||
@@ -565,7 +565,7 @@ impl App {
|
||||
None,
|
||||
|ui| {
|
||||
ui.label(frame, "");
|
||||
ui.columns(
|
||||
ui.column_bar(
|
||||
frame,
|
||||
[Column::new(
|
||||
Span::raw(" Loading ").magenta().slow_blink(),
|
||||
@@ -583,7 +583,7 @@ impl App {
|
||||
}
|
||||
|
||||
fn show_help_text(&self, frame: &mut Frame, ui: &mut im::Ui<Message>) {
|
||||
ui.columns(
|
||||
ui.column_bar(
|
||||
frame,
|
||||
[Column::new(Span::raw(" Help ").bold(), Constraint::Fill(1))].to_vec(),
|
||||
Some(Borders::Top),
|
||||
@@ -604,7 +604,7 @@ impl App {
|
||||
}
|
||||
|
||||
fn show_help_context(&self, frame: &mut Frame, ui: &mut im::Ui<Message>) {
|
||||
ui.bar(
|
||||
ui.column_bar(
|
||||
frame,
|
||||
[
|
||||
Column::new(
|
||||
|
||||
@@ -561,7 +561,7 @@ impl App {
|
||||
}
|
||||
};
|
||||
|
||||
ui.bar(frame, context, Some(Borders::None));
|
||||
ui.column_bar(frame, context, Some(Borders::None));
|
||||
}
|
||||
|
||||
pub fn show_browser_shortcuts(&self, frame: &mut Frame, ui: &mut im::Ui<Message>) {
|
||||
@@ -584,7 +584,7 @@ impl App {
|
||||
}
|
||||
|
||||
fn show_help_text(&self, frame: &mut Frame, ui: &mut im::Ui<Message>) {
|
||||
ui.columns(
|
||||
ui.column_bar(
|
||||
frame,
|
||||
[Column::new(Span::raw(" Help ").bold(), Constraint::Fill(1))].to_vec(),
|
||||
Some(Borders::Top),
|
||||
@@ -605,7 +605,7 @@ impl App {
|
||||
}
|
||||
|
||||
fn show_help_context(&self, frame: &mut Frame, ui: &mut im::Ui<Message>) {
|
||||
ui.bar(
|
||||
ui.column_bar(
|
||||
frame,
|
||||
[
|
||||
Column::new(
|
||||
|
||||
@@ -360,7 +360,7 @@ impl App<'_> {
|
||||
.unwrap_or_default();
|
||||
|
||||
ui.container(layout::container(), 1, |ui| {
|
||||
ui.columns(frame, hunk.inner().header(), Some(Borders::Top));
|
||||
ui.column_bar(frame, hunk.inner().header(), Some(Borders::Top));
|
||||
|
||||
if let Some(text) = hunk.inner().hunk_text() {
|
||||
let diff = ui.text_view(frame, text, &mut cursor, Some(Borders::BottomSides));
|
||||
@@ -409,7 +409,7 @@ impl App<'_> {
|
||||
),
|
||||
};
|
||||
|
||||
ui.bar(
|
||||
ui.column_bar(
|
||||
frame,
|
||||
[
|
||||
Column::new(
|
||||
@@ -526,7 +526,7 @@ impl Show<Message> for App<'_> {
|
||||
};
|
||||
let header = [Column::new(" Help ", Constraint::Fill(1))].to_vec();
|
||||
|
||||
ui.columns(frame, header, Some(Borders::Top));
|
||||
ui.column_bar(frame, header, Some(Borders::Top));
|
||||
let help = ui.text_view(
|
||||
frame,
|
||||
help_text().to_string(),
|
||||
|
||||
+2
-2
@@ -124,7 +124,7 @@ where
|
||||
]),
|
||||
Some(1),
|
||||
|ui| {
|
||||
ui.columns(frame, self.header.clone().to_vec(), Some(Borders::Top));
|
||||
ui.column_bar(frame, self.header.clone().to_vec(), Some(Borders::Top));
|
||||
|
||||
let table = ui.table(
|
||||
frame,
|
||||
@@ -151,7 +151,7 @@ where
|
||||
self.search.write(TextEditState { text, cursor });
|
||||
response.changed |= text_edit.changed;
|
||||
} else {
|
||||
ui.columns(frame, self.footer.clone().to_vec(), Some(Borders::Bottom));
|
||||
ui.column_bar(frame, self.footer.clone().to_vec(), Some(Borders::Bottom));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -96,7 +96,7 @@ impl Show<Message> for App {
|
||||
.to_vec();
|
||||
let mut selected = self.selector.selected();
|
||||
|
||||
ui.columns(frame, columns.clone(), Some(Borders::None));
|
||||
ui.column_bar(frame, columns.clone(), Some(Borders::None));
|
||||
|
||||
let table = ui.table(
|
||||
frame,
|
||||
|
||||
+3
-12
@@ -585,22 +585,13 @@ where
|
||||
widget::Shortcuts::new(shortcuts, divider).ui(self, frame)
|
||||
}
|
||||
|
||||
pub fn columns(
|
||||
pub fn column_bar(
|
||||
&mut self,
|
||||
frame: &mut Frame,
|
||||
columns: Vec<Column<'_>>,
|
||||
borders: Option<Borders>,
|
||||
) -> Response {
|
||||
widget::Columns::new(columns, borders).ui(self, frame)
|
||||
}
|
||||
|
||||
pub fn bar(
|
||||
&mut self,
|
||||
frame: &mut Frame,
|
||||
columns: Vec<Column<'_>>,
|
||||
borders: Option<Borders>,
|
||||
) -> Response {
|
||||
widget::Bar::new(columns, borders).ui(self, frame)
|
||||
widget::ColumnBar::new(columns, borders).ui(self, frame)
|
||||
}
|
||||
|
||||
pub fn text_view<'a>(
|
||||
@@ -634,7 +625,7 @@ where
|
||||
Some(label) => widget::TextEdit::new(text, cursor, borders)
|
||||
.with_label(label)
|
||||
.ui(self, frame),
|
||||
None => widget::TextEdit::new(text, cursor, borders).ui(self, frame),
|
||||
_ => widget::TextEdit::new(text, cursor, borders).ui(self, frame),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -577,7 +577,7 @@ where
|
||||
Layout::vertical([Constraint::Length(3), Constraint::Min(1)]),
|
||||
1,
|
||||
|ui| {
|
||||
ui.columns(frame, self.header.clone().to_vec(), Some(Borders::Top));
|
||||
ui.column_bar(frame, self.header.clone().to_vec(), Some(Borders::Top));
|
||||
|
||||
let table = ui.table(
|
||||
frame,
|
||||
@@ -595,18 +595,18 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Columns<'a> {
|
||||
pub struct ColumnBar<'a> {
|
||||
columns: Vec<Column<'a>>,
|
||||
borders: Option<Borders>,
|
||||
}
|
||||
|
||||
impl<'a> Columns<'a> {
|
||||
impl<'a> ColumnBar<'a> {
|
||||
pub fn new(columns: Vec<Column<'a>>, borders: Option<Borders>) -> Self {
|
||||
Self { columns, borders }
|
||||
}
|
||||
}
|
||||
|
||||
impl Widget for Columns<'_> {
|
||||
impl Widget for ColumnBar<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response
|
||||
where
|
||||
M: Clone,
|
||||
|
||||
Reference in New Issue
Block a user