From f054cd5f35f660ecfd75f350a374fbda1ebda425 Mon Sep 17 00:00:00 2001 From: agessaman Date: Wed, 7 Jan 2026 17:36:49 -0800 Subject: [PATCH] fix: Improve weather string handling to prevent emoji truncation - Updated the weather string concatenation logic to use display width for checking available space, ensuring emojis are not cut off. - Added a buffer of 5 characters to the maximum length check to enhance the user experience when displaying weather information. --- modules/commands/alternatives/wx_international.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/commands/alternatives/wx_international.py b/modules/commands/alternatives/wx_international.py index 7a66347..a019ee0 100644 --- a/modules/commands/alternatives/wx_international.py +++ b/modules/commands/alternatives/wx_international.py @@ -635,7 +635,9 @@ class GlobalWxCommand(BaseCommand): # Only show probability if no amount available precip_str = f" 🌦️{precip_prob}%" - if len(weather + precip_str) <= max_length: + # Use display width to check if we have space, with buffer to avoid cutting emojis + # Add buffer of 5 chars to ensure we don't truncate in middle of emoji + if self._count_display_width(weather + precip_str) <= max_length - 5: weather += precip_str return weather