From 2dac616bef98ac92fd4d4490545076c69880c1f8 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 13 Feb 2026 17:43:53 -0800 Subject: [PATCH] keyboard: fix hint text truncation and add trailing ellipsis (#37207) Widen the hint label rect so it doesn't reserve right-side space for the hidden backspace button, preventing unnecessary text eliding. Also show the blinking cursor over the hint and add trailing ellipsis to hint strings for consistency. Co-authored-by: Cursor --- selfdrive/ui/mici/layouts/settings/developer.py | 2 +- .../ui/mici/layouts/settings/network/__init__.py | 2 +- selfdrive/ui/mici/widgets/dialog.py | 13 +++++++++---- system/ui/mici_setup.py | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/selfdrive/ui/mici/layouts/settings/developer.py b/selfdrive/ui/mici/layouts/settings/developer.py index b6145e042..ad68d6ee9 100644 --- a/selfdrive/ui/mici/layouts/settings/developer.py +++ b/selfdrive/ui/mici/layouts/settings/developer.py @@ -29,7 +29,7 @@ class DeveloperLayoutMici(NavWidget): def ssh_keys_callback(): github_username = ui_state.params.get("GithubUsername") or "" - dlg = BigInputDialog("enter GitHub username", github_username, confirm_callback=github_username_callback) + dlg = BigInputDialog("enter GitHub username...", github_username, confirm_callback=github_username_callback) if not system_time_valid(): dlg = BigDialog("Please connect to Wi-Fi to fetch your key", "") gui_app.set_modal_overlay(dlg) diff --git a/selfdrive/ui/mici/layouts/settings/network/__init__.py b/selfdrive/ui/mici/layouts/settings/network/__init__.py index 3a0da36bb..bda619fee 100644 --- a/selfdrive/ui/mici/layouts/settings/network/__init__.py +++ b/selfdrive/ui/mici/layouts/settings/network/__init__.py @@ -144,7 +144,7 @@ class NetworkLayoutMici(NavWidget): self._wifi_manager.update_gsm_settings(ui_state.params.get_bool("GsmRoaming"), apn, ui_state.params.get_bool("GsmMetered")) current_apn = ui_state.params.get("GsmApn") or "" - dlg = BigInputDialog("enter APN", current_apn, minimum_length=0, confirm_callback=update_apn) + dlg = BigInputDialog("enter APN...", current_apn, minimum_length=0, confirm_callback=update_apn) gui_app.set_modal_overlay(dlg) def _toggle_cellular_metered(self, checked: bool): diff --git a/selfdrive/ui/mici/widgets/dialog.py b/selfdrive/ui/mici/widgets/dialog.py index b88ac2049..6b4cb92c1 100644 --- a/selfdrive/ui/mici/widgets/dialog.py +++ b/selfdrive/ui/mici/widgets/dialog.py @@ -195,11 +195,13 @@ class BigInputDialog(BigDialogBase): rl.BLACK, rl.BLANK) # draw cursor + blink_alpha = (math.sin(rl.get_time() * 6) + 1) / 2 if text: - blink_alpha = (math.sin(rl.get_time() * 6) + 1) / 2 cursor_x = min(text_x + text_size.x + 3, text_field_rect.x + text_field_rect.width) - rl.draw_rectangle_rounded(rl.Rectangle(int(cursor_x), int(text_field_rect.y), 4, int(text_size.y)), - 1, 4, rl.Color(255, 255, 255, int(255 * blink_alpha))) + else: + cursor_x = text_field_rect.x - 6 + rl.draw_rectangle_rounded(rl.Rectangle(int(cursor_x), int(text_field_rect.y), 4, int(text_size.y)), + 1, 4, rl.Color(255, 255, 255, int(255 * blink_alpha))) # draw backspace icon with nice fade self._backspace_img_alpha.update(255 * bool(text)) @@ -209,7 +211,10 @@ class BigInputDialog(BigDialogBase): if not text and self._hint_label.text and not candidate_char: # draw description if no text entered yet and not drawing candidate char - self._hint_label.render(text_field_rect) + hint_rect = rl.Rectangle(text_field_rect.x, text_field_rect.y, + self._rect.width - text_field_rect.x - PADDING, + text_field_rect.height) + self._hint_label.render(hint_rect) # TODO: move to update state # make rect take up entire area so it's easier to click diff --git a/system/ui/mici_setup.py b/system/ui/mici_setup.py index 1322e95ef..b5c0d0528 100755 --- a/system/ui/mici_setup.py +++ b/system/ui/mici_setup.py @@ -639,7 +639,7 @@ class Setup(Widget): if result == DialogResult.CANCEL: self._set_state(SetupState.SOFTWARE_SELECTION) - keyboard = BigInputDialog("custom software URL", confirm_callback=handle_keyboard_result) + keyboard = BigInputDialog("custom software URL...", confirm_callback=handle_keyboard_result) gui_app.set_modal_overlay(keyboard, callback=handle_keyboard_exit) def use_openpilot(self):