mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +00:00
Fix 4 bugs found in code review
- BotScreen keyboard: add explicit null-terminator after strncpy when trigger/reply text reaches max length (strncpy skips it in that case) - BotScreen keyboard: clamp _kb_col to 3 when moving DOWN to special row, so the cursor doesn't become invisible (col > 3 has no special-row item) - MyMesh: initialise _bot_last_reply_ms = 0 in constructor (was relying on BSS zero-init, which is technically UB for a non-trivial class member) - RingtoneEditor: exit via CANCEL/Save/Discard goes to ToolsScreen instead of HomeScreen — consistent with BotScreen and expected navigation flow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6f1c072298
commit
282d786ebe
@@ -2021,18 +2021,18 @@ public:
|
||||
the_mesh.savePrefs();
|
||||
}
|
||||
_task->stopMelody();
|
||||
_task->gotoHomeScreen();
|
||||
_task->gotoToolsScreen();
|
||||
break;
|
||||
case M_DISCARD:
|
||||
_task->stopMelody();
|
||||
_task->gotoHomeScreen();
|
||||
_task->gotoToolsScreen();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cancel) { _task->stopMelody(); _task->gotoHomeScreen(); return true; }
|
||||
if (cancel) { _task->stopMelody(); _task->gotoToolsScreen(); return true; }
|
||||
if (menu_key) { _menu_open = true; _menu_sel = 0; _menu_scroll = 0; return true; }
|
||||
|
||||
if (left && _cursor > 0) { _cursor--; clampScroll(); return true; }
|
||||
@@ -2245,7 +2245,11 @@ public:
|
||||
// keyboard input
|
||||
if (cancel) { _kb_field = -1; return true; }
|
||||
if (up && _kb_row > 0) { _kb_row--; return true; }
|
||||
if (down && _kb_row < KB_ROWS) { _kb_row++; return true; }
|
||||
if (down && _kb_row < KB_ROWS) {
|
||||
_kb_row++;
|
||||
if (_kb_row == KB_ROWS && _kb_col > 3) _kb_col = 3;
|
||||
return true;
|
||||
}
|
||||
if (left && _kb_col > 0) { _kb_col--; return true; }
|
||||
if (right && _kb_col < (_kb_row < KB_ROWS ? KB_COLS - 1 : 3)) { _kb_col++; return true; }
|
||||
if (enter) {
|
||||
@@ -2265,10 +2269,13 @@ public:
|
||||
case 2: if (_kb_len > 0) { _kb_buf[--_kb_len] = '\0'; } break;
|
||||
case 3:
|
||||
// commit
|
||||
if (_kb_field == 2)
|
||||
if (_kb_field == 2) {
|
||||
strncpy(_prefs->bot_trigger, _kb_buf, sizeof(_prefs->bot_trigger) - 1);
|
||||
else
|
||||
_prefs->bot_trigger[sizeof(_prefs->bot_trigger) - 1] = '\0';
|
||||
} else {
|
||||
strncpy(_prefs->bot_reply, _kb_buf, sizeof(_prefs->bot_reply) - 1);
|
||||
_prefs->bot_reply[sizeof(_prefs->bot_reply) - 1] = '\0';
|
||||
}
|
||||
_kb_field = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user