mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-10-18 19:10:36 +08:00
lib/ui: Spacing must be explicitely set for table
This commit is contained in:
@@ -373,6 +373,7 @@ impl App {
|
||||
¬ifs,
|
||||
header.to_vec(),
|
||||
Some("".into()),
|
||||
Spacing::from(1),
|
||||
Some(Borders::BottomSides),
|
||||
);
|
||||
if table.changed {
|
||||
|
||||
@@ -1361,6 +1361,7 @@ pub mod v2 {
|
||||
&issues,
|
||||
header.to_vec(),
|
||||
None,
|
||||
Spacing::from(1),
|
||||
Some(Borders::BottomSides),
|
||||
);
|
||||
if table.changed {
|
||||
|
||||
@@ -343,6 +343,7 @@ impl App {
|
||||
&patches,
|
||||
header.to_vec(),
|
||||
Some("No patches found".into()),
|
||||
Spacing::from(1),
|
||||
Some(Borders::BottomSides),
|
||||
);
|
||||
if table.changed {
|
||||
|
||||
@@ -354,6 +354,7 @@ impl App<'_> {
|
||||
&hunks,
|
||||
columns,
|
||||
None,
|
||||
Spacing::from(1),
|
||||
Some(Borders::BottomSides),
|
||||
);
|
||||
if table.changed {
|
||||
|
||||
@@ -138,6 +138,7 @@ where
|
||||
self.items,
|
||||
self.header.to_vec(),
|
||||
None,
|
||||
Spacing::from(1),
|
||||
if *self.show_search {
|
||||
Some(Borders::BottomSides)
|
||||
} else {
|
||||
|
||||
@@ -109,6 +109,7 @@ impl Show<Message> for App {
|
||||
&self.items,
|
||||
columns,
|
||||
None,
|
||||
Spacing::from(1),
|
||||
Some(Borders::None),
|
||||
);
|
||||
if table.changed {
|
||||
|
||||
+4
-1
@@ -558,12 +558,15 @@ where
|
||||
items: &'a Vec<R>,
|
||||
columns: Vec<Column<'a>>,
|
||||
empty_message: Option<String>,
|
||||
spacing: Spacing,
|
||||
borders: Option<Borders>,
|
||||
) -> Response
|
||||
where
|
||||
R: ToRow<W> + Clone,
|
||||
{
|
||||
widget::Table::new(selected, items, columns, empty_message, borders).ui(self, frame)
|
||||
widget::Table::new(selected, items, columns, empty_message, borders)
|
||||
.spacing(spacing)
|
||||
.ui(self, frame)
|
||||
}
|
||||
|
||||
pub fn shortcuts(
|
||||
|
||||
+8
-1
@@ -308,6 +308,7 @@ pub struct Table<'a, R, const W: usize> {
|
||||
items: &'a Vec<R>,
|
||||
selected: &'a mut Option<usize>,
|
||||
columns: Vec<Column<'a>>,
|
||||
spacing: Spacing,
|
||||
borders: Option<Borders>,
|
||||
show_scrollbar: bool,
|
||||
empty_message: Option<String>,
|
||||
@@ -329,6 +330,7 @@ where
|
||||
items,
|
||||
selected,
|
||||
columns,
|
||||
spacing: Spacing::from(1),
|
||||
empty_message,
|
||||
borders,
|
||||
show_scrollbar: true,
|
||||
@@ -340,6 +342,11 @@ where
|
||||
self.dim = dim;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn spacing(mut self, spacing: Spacing) -> Self {
|
||||
self.spacing = spacing;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<R, const W: usize> Widget for Table<'_, R, W>
|
||||
@@ -446,7 +453,7 @@ where
|
||||
let table = ratatui::widgets::Table::default()
|
||||
.rows(rows)
|
||||
.widths(widths)
|
||||
.column_spacing(1)
|
||||
.column_spacing(self.spacing.into())
|
||||
.row_highlight_style(style::highlight(area_focus));
|
||||
|
||||
let table = if !area_focus && self.dim {
|
||||
|
||||
Reference in New Issue
Block a user