From b9ecfeb8901424a87dbebc2e25cb43950b2e439c Mon Sep 17 00:00:00 2001 From: Reilly Wood <26268125+rgwood@users.noreply.github.com> Date: Sun, 1 Oct 2023 11:06:26 -0500 Subject: [PATCH] `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. --- crates/nu-explore/src/explore.rs | 38 +++++--------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/crates/nu-explore/src/explore.rs b/crates/nu-explore/src/explore.rs index 56e227716..e8f5ac6de 100644 --- a/crates/nu-explore/src/explore.rs +++ b/crates/nu-explore/src/explore.rs @@ -209,8 +209,6 @@ fn prepare_default_config(config: &mut HashMap) { 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) { 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> { @@ -307,25 +294,12 @@ fn insert_bool(map: &mut HashMap, key: &str, value: bool) { fn include_nu_config(config: &mut HashMap, 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)); } }