diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-06 22:53:56 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-06 22:53:56 +0300 |
| commit | 34df89ae655076b0493a1d8833f6790ca9d5c3ff (patch) | |
| tree | 3b2246673fbf12f4c68a2d6528932a71a9b40b85 /src/app/config_io.rs | |
| parent | 9f94974de704646ba9b45b1cfc09cba6139e8924 (diff) | |
fix: persist agent panel scope in config
Diffstat (limited to 'src/app/config_io.rs')
| -rw-r--r-- | src/app/config_io.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/app/config_io.rs b/src/app/config_io.rs index 6c51ad9f..a9199561 100644 --- a/src/app/config_io.rs +++ b/src/app/config_io.rs @@ -5,6 +5,11 @@ impl App { where F: FnOnce(&str) -> String, { + #[cfg(test)] + if std::env::var_os(crate::config::CONFIG_PATH_ENV_VAR).is_none() { + return false; + } + let path = crate::config::config_path(); if let Some(parent) = path.parent() { if let Err(err) = std::fs::create_dir_all(parent) { @@ -66,4 +71,25 @@ impl App { self.apply_config_from_disk(false); } } + + pub(super) fn save_agent_panel_scope(&mut self, scope: crate::app::state::AgentPanelScope) { + let value = match scope { + crate::app::state::AgentPanelScope::CurrentWorkspace => { + crate::config::AgentPanelScopeConfig::Current.as_str() + } + crate::app::state::AgentPanelScope::AllWorkspaces => { + crate::config::AgentPanelScopeConfig::All.as_str() + } + }; + if self.update_config_file("agent panel scope", |content| { + crate::config::upsert_section_value( + content, + "ui", + "agent_panel_scope", + &format!("\"{value}\""), + ) + }) { + self.apply_config_from_disk(false); + } + } } |
