fix: remove label prefix from keyboard preview for visual consistency

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 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-13 21:09:47 +02:00
co-authored by Claude Sonnet 4.6
parent 5fecafd4f9
commit 464f5cd7a2
3 changed files with 6 additions and 15 deletions
+1 -5
View File
@@ -164,21 +164,17 @@ public:
_kb_field = _sel; _kb_field = _sel;
const char* initial; const char* initial;
int max; int max;
const char* lbl;
if (_sel == 2) { if (_sel == 2) {
initial = _prefs->bot_trigger; initial = _prefs->bot_trigger;
max = sizeof(_prefs->bot_trigger) - 1; max = sizeof(_prefs->bot_trigger) - 1;
lbl = "Trigger:";
} else if (_sel == 3) { } else if (_sel == 3) {
initial = _prefs->bot_reply_dm; initial = _prefs->bot_reply_dm;
max = sizeof(_prefs->bot_reply_dm) - 1; max = sizeof(_prefs->bot_reply_dm) - 1;
lbl = "Reply:";
} else { } else {
initial = _prefs->bot_reply_ch; initial = _prefs->bot_reply_ch;
max = sizeof(_prefs->bot_reply_ch) - 1; max = sizeof(_prefs->bot_reply_ch) - 1;
lbl = "Reply:";
} }
_kb.begin(initial, max, lbl); _kb.begin(initial, max);
return true; return true;
} }
return false; return false;
@@ -27,7 +27,6 @@ struct KeyboardWidget {
char buf[KB_MAX_LEN + 1]; char buf[KB_MAX_LEN + 1];
int len; int len;
int max_len; int max_len;
char label[16];
int row, col; int row, col;
bool caps; bool caps;
bool ph_mode; bool ph_mode;
@@ -35,9 +34,7 @@ struct KeyboardWidget {
enum Result { NONE, DONE, CANCELLED }; enum Result { NONE, DONE, CANCELLED };
void begin(const char* initial = "", int max = KB_MAX_LEN, const char* lbl = "") { void begin(const char* initial = "", int max = KB_MAX_LEN) {
strncpy(label, lbl, sizeof(label) - 1);
label[sizeof(label) - 1] = '\0';
max_len = (max > KB_MAX_LEN) ? KB_MAX_LEN : max; max_len = (max > KB_MAX_LEN) ? KB_MAX_LEN : max;
strncpy(buf, initial, max_len); strncpy(buf, initial, max_len);
buf[max_len] = '\0'; buf[max_len] = '\0';
@@ -51,12 +48,12 @@ struct KeyboardWidget {
display.setTextSize(1); display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT); 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; const char* disp_start = buf;
int disp_len = len; int disp_len = len;
if (disp_len > 20) { disp_start = buf + (disp_len - 20); disp_len = 20; } if (disp_len > 20) { disp_start = buf + (disp_len - 20); disp_len = 20; }
char preview[40]; char preview[24];
snprintf(preview, sizeof(preview), "%s%.*s_", label, disp_len, disp_start); snprintf(preview, sizeof(preview), "%.*s_", disp_len, disp_start);
display.setCursor(0, KB_TEXT_Y); display.setCursor(0, KB_TEXT_Y);
display.print(preview); display.print(preview);
display.fillRect(0, KB_SEP_Y, display.width(), 1); display.fillRect(0, KB_SEP_Y, display.width(), 1);
+1 -3
View File
@@ -573,9 +573,7 @@ public:
if (isMsgSlot(_selected) && enter) { if (isMsgSlot(_selected) && enter) {
int slot = msgSlotIndex(_selected); int slot = msgSlotIndex(_selected);
_edit_slot = slot; _edit_slot = slot;
char lbl[6]; _kb.begin(p ? p->custom_msgs[slot] : "");
snprintf(lbl, sizeof(lbl), "M%d:", slot + 1);
_kb.begin(p ? p->custom_msgs[slot] : "", KB_MAX_LEN, lbl);
return true; return true;
} }
return false; return false;