fix(nav): drop nav view when target contact disappears; cap label entry

Review fixes:
- NearbyScreen: when the periodic detail refresh can't find the selected
  contact any more, clear _nav as well as _detail so the nav view and the
  input handler don't disagree about state.
- TrailScreen: bound the label keyboard to WAYPOINT_LABEL_LEN-1 (11) chars
  for both Mark-here and Rename, so the user can't type more than the stored
  label holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-03 08:36:41 +02:00
parent 6ca1c766ef
commit e578525a95
2 changed files with 3 additions and 3 deletions

View File

@@ -569,7 +569,7 @@ public:
if (_entries[i].contact_idx == saved_contact_idx) { _sel = i; found = true; break; }
}
}
if (!found) _detail = false;
if (!found) { _detail = false; _nav = false; } // contact gone — drop both views
_detail_refresh_ms = millis();
}

View File

@@ -113,7 +113,7 @@ public:
if (sel == 0) { // Rename
if (_wp_sel < _task->waypoints().count()) {
_kb_rename_idx = _wp_sel;
_wp_kb.begin(_task->waypoints().at(_wp_sel).label);
_wp_kb.begin(_task->waypoints().at(_wp_sel).label, WAYPOINT_LABEL_LEN - 1);
_kb_active = true;
}
} else { // Delete
@@ -356,7 +356,7 @@ private:
if (_task->waypoints().full()) { _task->showAlert("Waypoints full", 1000); return; }
_mark_lat = lat; _mark_lon = lon; _mark_ts = (uint32_t)rtc_clock.getCurrentTime();
_kb_rename_idx = -1;
_wp_kb.begin("");
_wp_kb.begin("", WAYPOINT_LABEL_LEN - 1);
_kb_active = true;
}