From fafb9c23bf768c275eb16f7235227ae6e9803be8 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Tue, 3 Mar 2026 19:02:33 -0800 Subject: [PATCH] fix: strip emoji characters from menu choices in interactive setup Updated the interactive setup in hermes CLI to remove emoji characters from menu choices. This change addresses visual issues caused by emoji miscalculations during terminal redraws, ensuring a cleaner and more readable interface for users. --- hermes_cli/setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py index 89551f7b..5b69e964 100644 --- a/hermes_cli/setup.py +++ b/hermes_cli/setup.py @@ -78,9 +78,15 @@ def prompt_choice(question: str, choices: list, default: int = 0) -> int: # Try to use interactive menu if available try: from simple_term_menu import TerminalMenu + import re - # Add visual indicators - menu_choices = [f" {choice}" for choice in choices] + # Strip emoji characters — simple_term_menu miscalculates visual + # width of emojis, causing duplicated/garbled lines on redraw. + _emoji_re = re.compile( + "[\U0001f300-\U0001f9ff\U00002600-\U000027bf\U0000fe00-\U0000fe0f" + "\U0001fa00-\U0001fa6f\U0001fa70-\U0001faff\u200d]+", flags=re.UNICODE + ) + menu_choices = [f" {_emoji_re.sub('', choice).strip()}" for choice in choices] terminal_menu = TerminalMenu( menu_choices,