mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +08:00
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 <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user