From e2501ca764c0e62b9844e64b37ac9bce3ba955c1 Mon Sep 17 00:00:00 2001 From: TomZz Date: Sat, 3 Oct 2026 17:30:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(config):=20=E4=BF=AE=E5=A4=8D=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E4=B8=8E=E7=95=8C=E9=9D=A2=E5=AD=97=E5=8F=B7=E5=9C=A8?= =?UTF-8?q?=E7=89=B9=E5=AE=9A=E6=95=B0=E5=80=BC=E4=B8=8B=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E8=A2=AB=E9=87=8D=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98=20(#117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/session/config.rs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/session/config.rs b/src/session/config.rs index c0a2a22..1bf1e62 100644 --- a/src/session/config.rs +++ b/src/session/config.rs @@ -409,9 +409,6 @@ fn default_terminal_font_size() -> f32 { 12.0 } -const LEGACY_DEFAULT_TERMINAL_FONT_SIZE: f32 = 18.0; -const LEGACY_DEFAULT_UI_FONT_SIZE: f32 = 16.0; - fn default_ui_font_size() -> f32 { 14.0 } @@ -1167,9 +1164,7 @@ impl ConfigStore { } pub fn terminal_font_size(&self) -> f32 { - if self.cache.terminal_font_size <= 0.0 - || (self.cache.terminal_font_size - LEGACY_DEFAULT_TERMINAL_FONT_SIZE).abs() < 0.01 - { + if self.cache.terminal_font_size <= 0.0 { default_terminal_font_size() } else { self.cache.terminal_font_size @@ -1287,10 +1282,7 @@ impl ConfigStore { } pub fn ui_font_size(&self) -> f32 { - if self.cache.ui_font_size <= 0.0 - || (self.cache.ui_font_size - LEGACY_DEFAULT_UI_FONT_SIZE).abs() < 0.01 - { - // Migrate the previous application default to the current compact default. + if self.cache.ui_font_size <= 0.0 { default_ui_font_size() } else { self.cache.ui_font_size @@ -1942,17 +1934,17 @@ mod tests { } #[test] - fn font_sizes_migrate_the_previous_defaults() { + fn font_sizes_preserve_user_configurations() { let mut store = ConfigStore::in_memory(); assert_eq!(store.terminal_font_size(), 12.0); assert_eq!(store.ui_font_size(), 14.0); store.set_terminal_font_size(18.0); - assert_eq!(store.terminal_font_size(), 12.0); + assert_eq!(store.terminal_font_size(), 18.0); - store.set_ui_font_size(14.0); - assert_eq!(store.ui_font_size(), 14.0); + store.set_ui_font_size(16.0); + assert_eq!(store.ui_font_size(), 16.0); store.set_ui_font_size(20.0); assert_eq!(store.ui_font_size(), 20.0);