forked from extern/nushell
parent
5886a74ccc
commit
a1dfc35968
File diff suppressed because one or more lines are too long
@ -154,8 +154,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult {
|
||||
return Err(*error.clone());
|
||||
}
|
||||
|
||||
let mut inner_cfg = cfg.clone();
|
||||
inner_cfg.opts.width = available_width;
|
||||
let inner_cfg = update_config(cfg.clone(), available_width);
|
||||
let (mut text, style) = expanded_table_entry2(item, inner_cfg);
|
||||
|
||||
let value_width = string_width(&text);
|
||||
@ -242,8 +241,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult {
|
||||
return Err(*error.clone());
|
||||
}
|
||||
|
||||
let mut inner_cfg = cfg.clone();
|
||||
inner_cfg.opts.width = available;
|
||||
let inner_cfg = update_config(cfg.clone(), available);
|
||||
let (mut text, style) = expanded_table_entry(item, header.as_str(), inner_cfg);
|
||||
|
||||
let mut value_width = string_width(&text);
|
||||
@ -405,8 +403,7 @@ fn expand_table_value(
|
||||
let span = value.span();
|
||||
match value {
|
||||
Value::List { vals, .. } => {
|
||||
let mut inner_cfg = dive_options(cfg, span);
|
||||
inner_cfg.opts.width = value_width;
|
||||
let inner_cfg = update_config(dive_options(cfg, span), value_width);
|
||||
let table = expanded_table_list(vals, inner_cfg)?;
|
||||
|
||||
match table {
|
||||
@ -436,8 +433,7 @@ fn expand_table_value(
|
||||
)));
|
||||
}
|
||||
|
||||
let mut inner_cfg = dive_options(cfg, span);
|
||||
inner_cfg.opts.width = value_width;
|
||||
let inner_cfg = update_config(dive_options(cfg, span), value_width);
|
||||
let result = expanded_table_kv(record, inner_cfg)?;
|
||||
match result {
|
||||
Some(result) => Ok(Some((result, true))),
|
||||
@ -601,3 +597,10 @@ fn value_to_wrapped_string_clean(value: &Value, cfg: &Cfg<'_>, value_width: usiz
|
||||
let text = nu_value_to_string_colored(value, cfg.opts.config, cfg.opts.style_computer);
|
||||
wrap_text(&text, value_width, cfg.opts.config)
|
||||
}
|
||||
|
||||
fn update_config(cfg: Cfg<'_>, width: usize) -> Cfg<'_> {
|
||||
let mut inner_cfg = cfg.clone();
|
||||
inner_cfg.opts.width = width;
|
||||
inner_cfg.opts.index_offset = 0;
|
||||
inner_cfg
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user