mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +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:
co-authored by
Claude Sonnet 4.6
parent
07bd5f1167
commit
5fecafd4f9
@@ -55,7 +55,7 @@ struct KeyboardWidget {
|
|||||||
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[32];
|
char preview[40];
|
||||||
snprintf(preview, sizeof(preview), "%s%.*s_", label, disp_len, disp_start);
|
snprintf(preview, sizeof(preview), "%s%.*s_", label, disp_len, disp_start);
|
||||||
display.setCursor(0, KB_TEXT_Y);
|
display.setCursor(0, KB_TEXT_Y);
|
||||||
display.print(preview);
|
display.print(preview);
|
||||||
@@ -147,7 +147,7 @@ struct KeyboardWidget {
|
|||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == KEY_CANCEL) return CANCELLED;
|
if (c == KEY_CANCEL || c == KEY_CONTEXT_MENU) return CANCELLED;
|
||||||
|
|
||||||
if (c == KEY_UP) {
|
if (c == KEY_UP) {
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user