Hi there,

The case which was presented must be addressed.

But I did not test it properly...
I'd encourage you to do so.

Take care.

---------

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
Maxim Zhiburt
2023-02-08 05:01:31 +03:00
committed by GitHub
parent a7fdca05c6
commit 6e6ef862c5
2 changed files with 118 additions and 25 deletions

View File

@ -1333,24 +1333,31 @@ fn convert_to_table2_entry(
return value_to_styled_string(item, config, style_computer);
}
let table = match &item {
match &item {
Value::Record { span, cols, vals } => {
if cols.is_empty() && vals.is_empty() {
return value_to_styled_string(item, config, style_computer);
}
convert_to_table2(
0,
std::iter::once(item),
// we verify what is the structure of a Record cause it might represent
let table = build_expanded_table(
cols.clone(),
vals.clone(),
*span,
ctrlc.clone(),
config,
*span,
style_computer,
width,
deep.map(|i| i - 1),
flatten,
flatten_sep,
width,
)
);
match table {
Ok(Some(table)) => (table, TextStyle::default()),
_ => value_to_styled_string(item, config, style_computer),
}
}
Value::List { vals, span } => {
if flatten {
@ -1363,7 +1370,7 @@ fn convert_to_table2_entry(
}
}
convert_to_table2(
let table = convert_to_table2(
0,
vals.iter(),
ctrlc.clone(),
@ -1374,24 +1381,24 @@ fn convert_to_table2_entry(
flatten,
flatten_sep,
width,
)
);
let (table, whead, windex) = match table {
Ok(Some(out)) => out,
_ => return value_to_styled_string(item, config, style_computer),
};
let count_rows = table.count_rows();
let table_config =
create_table_config(config, style_computer, count_rows, whead, windex, false);
let table = table.draw(table_config, usize::MAX);
match table {
Some(table) => (table, TextStyle::default()),
None => value_to_styled_string(item, config, style_computer),
}
}
_ => return value_to_styled_string(item, config, style_computer), // unknown type.
};
let (table, whead, windex) = match table {
Ok(Some(out)) => out,
_ => return value_to_styled_string(item, config, style_computer),
};
let count_rows = table.count_rows();
let table_config =
create_table_config(config, style_computer, count_rows, whead, windex, false);
let table = table.draw(table_config, usize::MAX);
match table {
Some(table) => (table, TextStyle::default()),
None => value_to_styled_string(item, config, style_computer),
_ => value_to_styled_string(item, config, style_computer), // unknown type.
}
}