explore: remove unused colour config code (#10570)

Remove code for 2 no-longer-used configuration options in `explore`:
`explore.config.cursor_color` and `explore.config.border_color`.

Think I made these unnecessary in
https://github.com/nushell/nushell/pull/10533 and
https://github.com/nushell/nushell/pull/10270 but missed this code, my
bad. The `explore` config code is a little hard to follow because it
does so many key lookups in hashmaps.
This commit is contained in:
Reilly Wood 2023-10-01 11:06:26 -05:00 committed by GitHub
parent 4dbbacc35d
commit b9ecfeb890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,8 +209,6 @@ fn prepare_default_config(config: &mut HashMap<String, Value>) {
const TABLE_SELECT_COLUMN: Style = color(None, None);
const CONFIG_CURSOR_COLOR: Style = color(Some(Color::Black), Some(Color::LightYellow));
insert_style(config, "status_bar_background", STATUS_BAR);
insert_style(config, "command_bar_text", INPUT_BAR);
insert_style(config, "highlight", HIGHLIGHT);
@ -244,17 +242,6 @@ fn prepare_default_config(config: &mut HashMap<String, Value>) {
config.insert(String::from("table"), map_into_value(hm));
}
{
let mut hm = config
.get("config")
.and_then(parse_hash_map)
.unwrap_or_default();
insert_style(&mut hm, "cursor_color", CONFIG_CURSOR_COLOR);
config.insert(String::from("config"), map_into_value(hm));
}
}
fn parse_hash_map(value: &Value) -> Option<HashMap<String, Value>> {
@ -307,25 +294,12 @@ fn insert_bool(map: &mut HashMap<String, Value>, key: &str, value: bool) {
fn include_nu_config(config: &mut HashMap<String, Value>, style_computer: &StyleComputer) {
let line_color = lookup_color(style_computer, "separator");
if line_color != nu_ansi_term::Style::default() {
{
let mut map = config
.get("table")
.and_then(parse_hash_map)
.unwrap_or_default();
insert_style(&mut map, "split_line", line_color);
config.insert(String::from("table"), map_into_value(map));
}
{
let mut map = config
.get("config")
.and_then(parse_hash_map)
.unwrap_or_default();
insert_style(&mut map, "border_color", line_color);
config.insert(String::from("config"), map_into_value(map));
}
let mut map = config
.get("table")
.and_then(parse_hash_map)
.unwrap_or_default();
insert_style(&mut map, "split_line", line_color);
config.insert(String::from("table"), map_into_value(map));
}
}