Skip to content

Commit

Permalink
Handle zero entries in table layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed Jan 18, 2024
1 parent 6ea9cda commit 220598e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/output/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ impl Table {
if det_idx == args.details.len() - 1 {
return None;
}
let end_lim = if !self.is_solo && det.uniformly_wide() {
// For uniform column, only compare the header and row #1...
let end_lim = if self.entries.is_empty() {
// If there are no entries, the limit must be zero.
0
} else if !self.is_solo && det.uniformly_wide() {
// For uniform columns, only compare the header and row #1.
1
} else {
// ...else, compare the header and every row.
// For non-uniform columns, compare the header and every row.
// This is much slower as makes two passes over every cell.
self.entries.len()
};
Expand Down

0 comments on commit 220598e

Please sign in to comment.