fix(ui): home page order and visibility bugs

- home_pages_mask XOR toggle initialises to HP_ALL before flipping bit,
  preventing accidental hiding of all other pages when mask starts at 0
- buildVisibleOrder appends any visible page missing from custom page_order,
  so pages absent from migrated/corrupted prefs remain navigable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-23 18:11:24 +02:00
co-authored by Claude Sonnet 4.6
parent 52faa0e2f6
commit 05335420e3
2 changed files with 8 additions and 0 deletions
@@ -600,6 +600,7 @@ public:
return true; return true;
} }
if (enter && homePageToggleable(_selected)) { if (enter && homePageToggleable(_selected)) {
if (!p->home_pages_mask) p->home_pages_mask = HP_ALL;
p->home_pages_mask ^= homePageBit(_selected); p->home_pages_mask ^= homePageBit(_selected);
_dirty = true; _dirty = true;
return true; return true;
@@ -232,6 +232,13 @@ class HomeScreen : public UIScreen {
int pg = bitToPage(v - 1); int pg = bitToPage(v - 1);
if (pg >= 0 && pg < (int)Count && isPageVisible(pg)) out[n++] = pg; if (pg >= 0 && pg < (int)Count && isPageVisible(pg)) out[n++] = pg;
} }
// Append any visible page missing from page_order (handles corrupted/migrated prefs)
for (int pg = 0; pg < (int)Count; pg++) {
if (!isPageVisible(pg)) continue;
bool found = false;
for (int i = 0; i < n; i++) if (out[i] == pg) { found = true; break; }
if (!found) out[n++] = pg;
}
} else { } else {
for (int pg = 0; pg < (int)Count; pg++) for (int pg = 0; pg < (int)Count; pg++)
if (isPageVisible(pg)) out[n++] = pg; if (isPageVisible(pg)) out[n++] = pg;