wip: Don't skip around so much when changing the size

portion of #5
This commit is contained in:
Jeremy Wall 2024-11-27 19:35:23 -05:00
parent 665d872f3d
commit 6b94455758
2 changed files with 3 additions and 2 deletions

View File

@ -16,7 +16,7 @@ use crate::ui::Address;
#[cfg(test)] #[cfg(test)]
mod test; mod test;
const COL_PIXELS: f64 = 10.0; const COL_PIXELS: f64 = 5.0;
/// A spreadsheet book with some internal state tracking. /// A spreadsheet book with some internal state tracking.
pub struct Book { pub struct Book {

View File

@ -106,6 +106,7 @@ impl<'book> Viewport<'book> {
// subtract the first columns size. // subtract the first columns size.
length = length - first.length; length = length - first.length;
// remove the first column. // remove the first column.
// TODO(jwall): This is a bit inefficient. Can we do better?
visible = visible.into_iter().skip(1).collect(); visible = visible.into_iter().skip(1).collect();
} }
// Add this col to the visible. // Add this col to the visible.
@ -193,7 +194,7 @@ impl<'book> Viewport<'book> {
col_constraints.extend(constraints.into_iter()); col_constraints.extend(constraints.into_iter());
Ok(Table::new(rows, col_constraints) Ok(Table::new(rows, col_constraints)
.header(Row::new(header).underlined()) .header(Row::new(header).underlined())
.column_spacing(1) .column_spacing(0)
.flex(Flex::Start)) .flex(Flex::Start))
} }
} }