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 18:34:33 +02:00
parent 5fecafd4f9
commit 464f5cd7a2
3 changed files with 6 additions and 15 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;