mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 14:37:59 +02:00
Revert "Add an option to move header on borders" (#9908)
Reverts nushell/nushell#9796 This is just draft since we're seeing some issues with the latest fixes to table drawing that just landed with #9796. We're hoping to get these fixed, but if we're not able to fix them before the next release, we'll need to revert (hence this PR, just in case we need it).
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
use nu_color_config::StyleComputer;
|
||||
use nu_protocol::{Span, Value};
|
||||
use nu_table::{
|
||||
common::{nu_value_to_string, nu_value_to_string_clean},
|
||||
ExpandedTable, TableOpts,
|
||||
};
|
||||
use nu_table::{value_to_clean_styled_string, value_to_styled_string, BuildConfig, ExpandedTable};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
|
||||
@ -21,9 +18,9 @@ pub fn try_build_table(
|
||||
try_build_map(cols, vals, span, style_computer, ctrlc, config)
|
||||
}
|
||||
val if matches!(val, Value::String { .. }) => {
|
||||
nu_value_to_string_clean(&val, config, style_computer).0
|
||||
value_to_clean_styled_string(&val, config, style_computer).0
|
||||
}
|
||||
val => nu_value_to_string(&val, config, style_computer).0,
|
||||
val => value_to_styled_string(&val, config, style_computer).0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,19 +32,12 @@ fn try_build_map(
|
||||
ctrlc: Option<Arc<AtomicBool>>,
|
||||
config: &NuConfig,
|
||||
) -> String {
|
||||
let opts = TableOpts::new(
|
||||
config,
|
||||
style_computer,
|
||||
ctrlc,
|
||||
Span::unknown(),
|
||||
0,
|
||||
usize::MAX,
|
||||
);
|
||||
let opts = BuildConfig::new(ctrlc, config, style_computer, Span::unknown(), usize::MAX);
|
||||
let result = ExpandedTable::new(None, false, String::new()).build_map(&cols, &vals, opts);
|
||||
match result {
|
||||
Ok(Some(result)) => result,
|
||||
Ok(None) | Err(_) => {
|
||||
nu_value_to_string(&Value::Record { cols, vals, span }, config, style_computer).0
|
||||
value_to_styled_string(&Value::Record { cols, vals, span }, config, style_computer).0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,20 +49,13 @@ fn try_build_list(
|
||||
span: Span,
|
||||
style_computer: &StyleComputer,
|
||||
) -> String {
|
||||
let opts = TableOpts::new(
|
||||
config,
|
||||
style_computer,
|
||||
ctrlc,
|
||||
Span::unknown(),
|
||||
0,
|
||||
usize::MAX,
|
||||
);
|
||||
let result = ExpandedTable::new(None, false, String::new()).build_list(&vals, opts);
|
||||
let opts = BuildConfig::new(ctrlc, config, style_computer, Span::unknown(), usize::MAX);
|
||||
let result = ExpandedTable::new(None, false, String::new()).build_list(&vals, opts, 0);
|
||||
match result {
|
||||
Ok(Some(out)) => out,
|
||||
Ok(None) | Err(_) => {
|
||||
// it means that the list is empty
|
||||
nu_value_to_string(&Value::List { vals, span }, config, style_computer).0
|
||||
value_to_styled_string(&Value::List { vals, span }, config, style_computer).0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user