From 0d900a20eac3576b1c80489e54182b8e1d9cdef6 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 18 Sep 2025 14:15:18 +0800 Subject: [PATCH] remove can't save option Signed-off-by: 21pages --- src/config.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config.rs b/src/config.rs index 5c13cfdda..852432be5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1024,6 +1024,10 @@ impl Config { pub fn set_option(k: String, v: String) { if !is_option_can_save(&OVERWRITE_SETTINGS, &k, &DEFAULT_SETTINGS, &v) { + let mut config = CONFIG2.write().unwrap(); + if config.options.remove(&k).is_some() { + config.store(); + } return; } let mut config = CONFIG2.write().unwrap(); @@ -1800,6 +1804,10 @@ impl LocalConfig { pub fn set_option(k: String, v: String) { if !is_option_can_save(&OVERWRITE_LOCAL_SETTINGS, &k, &DEFAULT_LOCAL_SETTINGS, &v) { + let mut config = LOCAL_CONFIG.write().unwrap(); + if config.options.remove(&k).is_some() { + config.store(); + } return; } let mut config = LOCAL_CONFIG.write().unwrap(); @@ -1960,6 +1968,9 @@ impl UserDefaultConfig { &DEFAULT_DISPLAY_SETTINGS, &value, ) { + if self.options.remove(&key).is_some() { + self.store(); + } return; } if value.is_empty() {