mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix: KeyboardWidget preview buffer size and KEY_CONTEXT_MENU handling
- preview[] increased from 32 to 40 bytes to safely fit max label (15 chars) + 20 chars text + cursor + null without snprintf truncation - KEY_CONTEXT_MENU (long-press ENTER) now treated as CANCEL in keyboard input handler, restoring BotScreen behavior lost in the refactor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,7 +55,7 @@ struct KeyboardWidget {
|
||||
const char* disp_start = buf;
|
||||
int disp_len = len;
|
||||
if (disp_len > 20) { disp_start = buf + (disp_len - 20); disp_len = 20; }
|
||||
char preview[32];
|
||||
char preview[40];
|
||||
snprintf(preview, sizeof(preview), "%s%.*s_", label, disp_len, disp_start);
|
||||
display.setCursor(0, KB_TEXT_Y);
|
||||
display.print(preview);
|
||||
@@ -147,7 +147,7 @@ struct KeyboardWidget {
|
||||
return NONE;
|
||||
}
|
||||
|
||||
if (c == KEY_CANCEL) return CANCELLED;
|
||||
if (c == KEY_CANCEL || c == KEY_CONTEXT_MENU) return CANCELLED;
|
||||
|
||||
if (c == KEY_UP) {
|
||||
if (row > 0) {
|
||||
|
||||
Reference in New Issue
Block a user