From 2f8aec7de8f866abe0a7b2420b6460dd789f53e3 Mon Sep 17 00:00:00 2001 From: ClementTsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 12 Sep 2024 04:27:47 -0400 Subject: [PATCH 1/3] bug: fix using 'none' for legend position in configs --- src/canvas/components/tui_widget/time_chart.rs | 2 +- src/options.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/canvas/components/tui_widget/time_chart.rs b/src/canvas/components/tui_widget/time_chart.rs index 922908d25..48e083fa5 100644 --- a/src/canvas/components/tui_widget/time_chart.rs +++ b/src/canvas/components/tui_widget/time_chart.rs @@ -223,7 +223,7 @@ impl FromStr for LegendPosition { type Err = ParseLegendPositionError; fn from_str(s: &str) -> Result { - match s.to_ascii_lowercase().as_str() { + match s { "top" => Ok(Self::Top), "top-left" => Ok(Self::TopLeft), "top-right" => Ok(Self::TopRight), diff --git a/src/options.rs b/src/options.rs index 72058cff5..203f3c93c 100644 --- a/src/options.rs +++ b/src/options.rs @@ -960,8 +960,11 @@ fn get_network_legend_position( position => Some(parse_config_value!(position.parse(), "network_legend")?), } } else if let Some(flags) = &config.flags { - if let Some(legend) = &flags.network_legend { - Some(parse_arg_value!(legend.parse(), "network_legend")?) + if let Some(s) = &flags.network_legend { + match s.to_ascii_lowercase().trim() { + "none" => None, + position => Some(parse_arg_value!(position.parse(), "network_legend")?), + } } else { Some(LegendPosition::default()) } From f3ce9b572daeb71a938092edfaa4b83a84c3bf88 Mon Sep 17 00:00:00 2001 From: ClementTsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 12 Sep 2024 04:30:21 -0400 Subject: [PATCH 2/3] forgot memory oops --- src/options.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/options.rs b/src/options.rs index 203f3c93c..77f690f9c 100644 --- a/src/options.rs +++ b/src/options.rs @@ -984,8 +984,11 @@ fn get_memory_legend_position( position => Some(parse_config_value!(position.parse(), "memory_legend")?), } } else if let Some(flags) = &config.flags { - if let Some(legend) = &flags.memory_legend { - Some(parse_arg_value!(legend.parse(), "memory_legend")?) + if let Some(s) = &flags.memory_legend { + match s.to_ascii_lowercase().trim() { + "none" => None, + position => Some(parse_arg_value!(position.parse(), "memory_legend")?), + } } else { Some(LegendPosition::default()) } From 2f806b97451f5d215165e38990c6709b2773f74c Mon Sep 17 00:00:00 2001 From: ClementTsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 12 Sep 2024 04:34:18 -0400 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f2e38ad..ce19bdb6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ That said, these are more guidelines rather than hardset rules, though the proje - [#1551](https://github.com/ClementTsang/bottom/pull/1551): Fix missing parent section names in default config. - [#1552](https://github.com/ClementTsang/bottom/pull/1552): Fix typo in default config. - [#1578](https://github.com/ClementTsang/bottom/pull/1578): Fix missing selected text background colour in `default-light` theme. +- [#1593](https://github.com/ClementTsang/bottom/pull/1593): Fix using `"none"` for chart legend position in configs. ### Changes