Skip to content

Commit

Permalink
improve map formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Dec 28, 2023
1 parent e94f043 commit 572cc08
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/grid_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ impl<T: GridFmt + ArrayValue> GridFmt for Array<T> {
metagrid.push(vec![key, vec![" → ".chars().collect()], value]);
}
if empty_entries > 0 {
metagrid.push(vec![vec![format!("… {empty_entries}").chars().collect()]])
metagrid.push(vec![
vec![format!("… {empty_entries}").chars().collect()],
vec![],
vec![],
])
}
}
}
Expand Down Expand Up @@ -373,7 +377,7 @@ fn pad_grid_center(width: usize, height: usize, align_numbers: bool, grid: &mut
row.truncate(width);
if row.len() < width {
let diff = width - row.len();
let post_pad = if align_numbers && row.last().map_or(false, char::is_ascii_digit) {
let post_pad = if align_numbers && row.last().is_some_and(char::is_ascii_digit) {
0
} else {
(diff + 1) / 2
Expand Down

0 comments on commit 572cc08

Please sign in to comment.