mirror of
https://github.com/nushell/nushell.git
synced 2025-04-27 06:38:21 +02:00
nu-table: Remove a error prone assertion (#5993)
This commit is contained in:
parent
c0ce78f892
commit
6802a4ee21
@ -57,18 +57,7 @@ pub fn draw_table(
|
|||||||
let table = build_table(data, headers, Some(alignments), config, with_footer);
|
let table = build_table(data, headers, Some(alignments), config, with_footer);
|
||||||
let table = load_theme(table, color_hm, theme, with_footer, with_header);
|
let table = load_theme(table, color_hm, theme, with_footer, with_header);
|
||||||
|
|
||||||
print_table(table, termwidth)
|
Some(table.to_string())
|
||||||
}
|
|
||||||
|
|
||||||
fn print_table(table: tabled::Table, term_width: usize) -> Option<String> {
|
|
||||||
let s = table.to_string();
|
|
||||||
|
|
||||||
let width = s.lines().next().map(papergrid::string_width).unwrap_or(0);
|
|
||||||
if width > term_width {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(s)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_alignment_map(data: &[Vec<StyledString>]) -> Vec<Vec<Alignment>> {
|
fn build_alignment_map(data: &[Vec<StyledString>]) -> Vec<Vec<Alignment>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user