diff --git a/src/format/table.rs b/src/format/table.rs index 76ea37ee9..6321d7189 100644 --- a/src/format/table.rs +++ b/src/format/table.rs @@ -54,7 +54,7 @@ impl TableView { }; if values.len() > 1 { - row.insert(0, format!("{}", Color::Black.bold().paint(idx.to_string()))); + row.insert(0, format!("{}", idx.to_string())); } entries.push(row); } @@ -75,7 +75,7 @@ impl TableView { max_per_column.push(current_row_max); } - let termwidth = textwrap::termwidth() - 5; + let termwidth = textwrap::termwidth() - 9; // Make sure we have enough space for the columns we have let max_num_of_columns = termwidth / 7; @@ -123,6 +123,14 @@ impl TableView { } } + // Paint the number column, if it exists + if entries.len() > 1 { + for row in 0..entries.len() { + entries[row][0] = + format!("{}", Color::Black.bold().paint(entries[row][0].to_string())); + } + } + Some(TableView { headers, entries }) } }