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.
This commit is contained in:
agessaman
2026-01-07 17:36:49 -08:00
parent 578fa2caa4
commit f054cd5f35

View File

@@ -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