Skip to content

Commit

Permalink
explore: remove unused colour config code (#10570)
Browse files Browse the repository at this point in the history
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
#10533 and
#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.
  • Loading branch information
rgwood committed Oct 1, 2023
1 parent 4dbbacc commit b9ecfeb
Showing 1 changed file with 6 additions and 32 deletions.
38 changes: 6 additions & 32 deletions crates/nu-explore/src/explore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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>> {
Expand Down Expand Up @@ -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));
}
}

Expand Down

0 comments on commit b9ecfeb

Please sign in to comment.