Skip to content

Commit

Permalink
fix a grid formatting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jan 10, 2024
1 parent 6ac731b commit 56939f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/grid_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,15 @@ fn fmt_array<T: GridFmt + ArrayValue>(shape: &[usize], data: &[T], metagrid: &mu
}
let shape = &shape[1..];
let cell_size = data.len() / cell_count;
let row_size: usize = shape.iter().take(shape.len().saturating_sub(1)).product();
for (i, cell) in data.chunks(cell_size).enumerate() {
if i > 0 && rank > 2 {
for _ in 0..rank - 2 {
metagrid.push(vec![vec![vec![' ']]; metagrid.last().unwrap().len()]);
}
}
fmt_array(shape, cell, metagrid);
if i * cell_size > 1000 {
if i * row_size > 1000 {
let mut elipses_row = Vec::new();
for prev_grid in metagrid.last().unwrap() {
let prev_row = &prev_grid[0];
Expand Down

0 comments on commit 56939f9

Please sign in to comment.