From 40d7cb6ae50bf1dc6554530cb88033721286eb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Fri, 22 Nov 2024 16:36:55 +0100 Subject: [PATCH 1/2] UX Improvement --- CHANGELOG.md | 1 + src/tui.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90e0445..e349690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed +- Don't deselect just selected option ### Removed diff --git a/src/tui.rs b/src/tui.rs index 3ba1395..1837ffe 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -67,6 +67,7 @@ impl Repository { self.selected.push(option.name.to_string()); } + let toggled_option = option.clone(); let currently_selected = self.selected.clone(); for option in currently_selected { let Some(option) = find_option(&option, self.options) else { @@ -79,7 +80,9 @@ impl Repository { } } for disable in option.disables { - if self.selected.contains(&disable.to_string()) { + if disable != &toggled_option.name + && self.selected.contains(&disable.to_string()) + { let Some(idx) = self.selected.iter().position(|v| v == disable) else { ratatui::restore(); panic!("disable option not found"); From 185d207ca6af59d481dc84c1430489330f7f91b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Fri, 22 Nov 2024 16:43:11 +0100 Subject: [PATCH 2/2] Clippy --- src/tui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tui.rs b/src/tui.rs index 1837ffe..4d639bc 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -67,7 +67,7 @@ impl Repository { self.selected.push(option.name.to_string()); } - let toggled_option = option.clone(); + let toggled_option = option; let currently_selected = self.selected.clone(); for option in currently_selected { let Some(option) = find_option(&option, self.options) else {