mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 07:30:13 +01:00
Add more polish to table wrap
This commit is contained in:
parent
ffd60bb3af
commit
8a66a000e4
@ -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 })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user