From ee5168254e1304934d9588a2ab452028ed36ac55 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 6 Jul 2023 00:20:43 +0800 Subject: [PATCH] fix #396 --- services/status/src/wifi.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/status/src/wifi.rs b/services/status/src/wifi.rs index 523afe650..e5bfd86f1 100644 --- a/services/status/src/wifi.rs +++ b/services/status/src/wifi.rs @@ -266,8 +266,15 @@ impl WLANMan { self.modals.dynamic_notification_close().ok(); } let mut networks: Vec<&str> = networks.iter().map(|s| s.as_str()).collect(); - // TODO: we may need to add code here to truncate the list if it is too long, with the larger - // font, the dialog box could run off the screen. + // don't show empty strings + networks.retain(|&n| n.len() != 0); + // limit the total number displayed so that the "okay" button does not disappear off the bottom + let max_entries = match gam::SYSTEM_STYLE { + graphics_server::GlyphStyle::Tall => 13, + graphics_server::GlyphStyle::Regular => 16, + _ => 12, + }; + networks.truncate(max_entries); if networks.is_empty() { self.modals