From 464f5cd7a22bc332ab2030d17a4e848d266393cf Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Wed, 13 May 2026 18:34:33 +0200 Subject: [PATCH] fix: remove label prefix from keyboard preview for visual consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All three keyboard instances (Settings, QuickMsg, Bot) now show plain text + cursor without any field-name prefix. Removes the label field from KeyboardWidget entirely — the screen title already indicates context. Co-Authored-By: Claude Sonnet 4.6 --- examples/companion_radio/ui-new/BotScreen.h | 6 +----- examples/companion_radio/ui-new/KeyboardWidget.h | 11 ++++------- examples/companion_radio/ui-new/UITask.cpp | 4 +--- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/examples/companion_radio/ui-new/BotScreen.h b/examples/companion_radio/ui-new/BotScreen.h index 8966c507..f1b9747d 100644 --- a/examples/companion_radio/ui-new/BotScreen.h +++ b/examples/companion_radio/ui-new/BotScreen.h @@ -164,21 +164,17 @@ public: _kb_field = _sel; const char* initial; int max; - const char* lbl; if (_sel == 2) { initial = _prefs->bot_trigger; max = sizeof(_prefs->bot_trigger) - 1; - lbl = "Trigger:"; } else if (_sel == 3) { initial = _prefs->bot_reply_dm; max = sizeof(_prefs->bot_reply_dm) - 1; - lbl = "Reply:"; } else { initial = _prefs->bot_reply_ch; max = sizeof(_prefs->bot_reply_ch) - 1; - lbl = "Reply:"; } - _kb.begin(initial, max, lbl); + _kb.begin(initial, max); return true; } return false; diff --git a/examples/companion_radio/ui-new/KeyboardWidget.h b/examples/companion_radio/ui-new/KeyboardWidget.h index 44733404..524598f9 100644 --- a/examples/companion_radio/ui-new/KeyboardWidget.h +++ b/examples/companion_radio/ui-new/KeyboardWidget.h @@ -27,7 +27,6 @@ struct KeyboardWidget { char buf[KB_MAX_LEN + 1]; int len; int max_len; - char label[16]; int row, col; bool caps; bool ph_mode; @@ -35,9 +34,7 @@ struct KeyboardWidget { enum Result { NONE, DONE, CANCELLED }; - void begin(const char* initial = "", int max = KB_MAX_LEN, const char* lbl = "") { - strncpy(label, lbl, sizeof(label) - 1); - label[sizeof(label) - 1] = '\0'; + void begin(const char* initial = "", int max = KB_MAX_LEN) { max_len = (max > KB_MAX_LEN) ? KB_MAX_LEN : max; strncpy(buf, initial, max_len); buf[max_len] = '\0'; @@ -51,12 +48,12 @@ struct KeyboardWidget { display.setTextSize(1); display.setColor(DisplayDriver::LIGHT); - // text preview: scroll so cursor is always visible (last 20 chars) + // text preview: last 20 chars + cursor const char* disp_start = buf; int disp_len = len; if (disp_len > 20) { disp_start = buf + (disp_len - 20); disp_len = 20; } - char preview[40]; - snprintf(preview, sizeof(preview), "%s%.*s_", label, disp_len, disp_start); + char preview[24]; + snprintf(preview, sizeof(preview), "%.*s_", disp_len, disp_start); display.setCursor(0, KB_TEXT_Y); display.print(preview); display.fillRect(0, KB_SEP_Y, display.width(), 1); diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 1fe60456..bcf694b1 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -573,9 +573,7 @@ public: if (isMsgSlot(_selected) && enter) { int slot = msgSlotIndex(_selected); _edit_slot = slot; - char lbl[6]; - snprintf(lbl, sizeof(lbl), "M%d:", slot + 1); - _kb.begin(p ? p->custom_msgs[slot] : "", KB_MAX_LEN, lbl); + _kb.begin(p ? p->custom_msgs[slot] : ""); return true; } return false;