Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-tui/src/widgets/table.rs')
| -rw-r--r-- | helix-tui/src/widgets/table.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs index 5f4667b7..3564871d 100644 --- a/helix-tui/src/widgets/table.rs +++ b/helix-tui/src/widgets/table.rs @@ -34,17 +34,11 @@ pub struct Cell<'a> { style: Style, } -impl Cell<'_> { +impl<'a> Cell<'a> { /// Set the `Style` of this cell. pub fn style(mut self, style: Style) -> Self { - self.set_style(style); - self - } - - /// Set the `Style` of this cell. - pub fn set_style(&mut self, style: Style) { self.style = style; - self.content.patch_style(style); + self } } @@ -337,7 +331,6 @@ impl<'a> Table<'a> { } } -/// Track [Table] scroll offset and selection #[derive(Debug, Default, Clone)] pub struct TableState { pub offset: usize, @@ -358,7 +351,7 @@ impl TableState { } // impl<'a> StatefulWidget for Table<'a> { -impl Table<'_> { +impl<'a> Table<'a> { // type State = TableState; pub fn render_table( @@ -459,9 +452,6 @@ impl Table<'_> { }; if is_selected { buf.set_style(table_row_area, self.highlight_style); - for cell in &mut table_row.cells { - cell.set_style(self.highlight_style); - } } let mut col = table_row_start_col; for (width, cell) in columns_widths.iter().zip(table_row.cells.iter()) { @@ -496,7 +486,7 @@ fn render_cell(buf: &mut Buffer, cell: &Cell, area: Rect, truncate: bool) { } } -impl Widget for Table<'_> { +impl<'a> Widget for Table<'a> { fn render(self, area: Rect, buf: &mut Buffer) { let mut state = TableState::default(); Table::render_table(self, area, buf, &mut state, false); |