fix the cn and ru words wrap and too long issue
What changed, and why it matters
This commit fixes a UI text display problem where Chinese and Russian labels in the on-screen keyboard hint box could wrap awkwardly or become too long. It introduces a helper that only enables text wrapping/scrolling when the label is wider than 408 pixels. There is no direct security vulnerability in the diff; it is a cosmetic/layout fix.
No security action required; treat as a normal UI bug fix. If desired, verify that 408 px is the intended design width and that long translated strings remain readable.
Security signals we found
No memory safety issues observed
No input validation changes
No cryptographic or authentication code touched
UI layout/text truncation fix only
Evidence from the diff
The change adds a constant KEYBOARD_WIDGET_TEXT_WIDTH (408 px) and a helper SetKeyboardWidgetBoundedLabelText() that measures a label’s self-width and, only if it exceeds the bound, applies a long mode (circular scroll for titles, wrap for descriptions) and constrains the label width. It replaces direct lv_label_set_text() calls in SetKeyboardWidgetTitle(). The fix is defensive UI layout hardening and does not alter input handling, memory allocation, or cryptographic code.
Changed components
src/ui/gui_components/gui_keyboard_hintbox.cKeyboardWidget titleLabelKeyboardWidget noticeLabelInspect captured patch +15 / −2
diff --git a/src/ui/gui_components/gui_keyboard_hintbox.c b/src/ui/gui_components/gui_keyboard_hintbox.c
index 7b5f78c..3115d20 100644
--- a/src/ui/gui_components/gui_keyboard_hintbox.c
+++ b/src/ui/gui_components/gui_keyboard_hintbox.c
@@ -26,6 +26,7 @@
#endif
#define DEFAULT_TIMER_COUNTER 5
+#define KEYBOARD_WIDGET_TEXT_WIDTH 408
static KeyboardWidget_t *CreateKeyboardWidget();
static void KeyboardConfirmHandler(lv_event_t *e);
@@ -113,6 +114,16 @@ void SetKeyboardWidgetSelf(KeyboardWidget_t *keyboardWidget, KeyboardWidget_t **
keyboardWidget->self = self;
}
+static void SetKeyboardWidgetBoundedLabelText(lv_obj_t *label, const char *text,
+ lv_label_long_mode_t longMode)
+{
+ lv_label_set_text(label, text);
+ if (lv_obj_get_self_width(label) > KEYBOARD_WIDGET_TEXT_WIDTH) {
+ lv_label_set_long_mode(label, longMode);
+ lv_obj_set_width(label, KEYBOARD_WIDGET_TEXT_WIDTH);
+ }
+}
+
// Override the default title/desc (used e.g. by the forget-pass "Prove Device Ownership" step). Pass NULL to
// leave a field unchanged.
void SetKeyboardWidgetTitle(KeyboardWidget_t *keyboardWidget, const char *title, const char *desc)
@@ -121,10 +132,12 @@ void SetKeyboardWidgetTitle(KeyboardWidget_t *keyboardWidget, const char *title,
return;
}
if (title != NULL && keyboardWidget->titleLabel != NULL) {
- lv_label_set_text(keyboardWidget->titleLabel, title);
+ SetKeyboardWidgetBoundedLabelText(keyboardWidget->titleLabel, title,
+ LV_LABEL_LONG_SCROLL_CIRCULAR);
}
if (desc != NULL && keyboardWidget->noticeLabel != NULL) {
- lv_label_set_text(keyboardWidget->noticeLabel, desc);
+ SetKeyboardWidgetBoundedLabelText(keyboardWidget->noticeLabel, desc,
+ LV_LABEL_LONG_WRAP);
}
}
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.