diff --git a/src/lib.rs b/src/lib.rs index 154c0202..0bca3455 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,9 +15,9 @@ use anyhow::Result; use store::State; use task::Interrupted; +use ui::im; use ui::widget::Widget; use ui::Frontend; -use ui::im; /// An optional return value. #[derive(Clone, Debug)] diff --git a/src/ui.rs b/src/ui.rs index 1f744ba6..2947d948 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,9 +1,9 @@ pub mod ext; +pub mod im; pub mod layout; pub mod span; pub mod theme; pub mod widget; -pub mod im; use std::fmt::Debug; use std::time::Duration; diff --git a/src/ui/im.rs b/src/ui/im.rs index 06df204a..ccd1f914 100644 --- a/src/ui/im.rs +++ b/src/ui/im.rs @@ -811,15 +811,8 @@ pub mod widget { .collect(); if has_items { - let [table_area, scroller_area] = Layout::horizontal([ - Constraint::Min(1), - if show_scrollbar { - Constraint::Length(1) - } else { - Constraint::Length(0) - }, - ]) - .areas(area); + let [table_area, scroller_area] = + Layout::horizontal([Constraint::Min(1), Constraint::Length(1)]).areas(area); let rows = self .items @@ -830,7 +823,7 @@ pub mod widget { for cell in item.to_row() { if let Some(col) = it.next() { - if !col.skip && col.displayed(area.width as usize) { + if !col.skip && col.displayed(table_area.width as usize) { cells.push(cell.clone()) } } else { @@ -997,11 +990,13 @@ pub mod widget { let cells = self .columns .iter() + .filter(|c| !c.skip && c.displayed(area.width as usize)) .map(|c| c.text.clone()) .collect::>(); let table = ratatui::widgets::Table::default() - .header(Row::new(cells)) + .column_spacing(1) + .rows([Row::new(cells)]) .widths(widths); frame.render_widget(table, area);