Skip to content

Fix small-screen profile picker navigation#751

Open
EyJunge1 wants to merge 2 commits into
jniebuhr:masterfrom
EyJunge1:fix/profile-picker-favorites
Open

Fix small-screen profile picker navigation#751
EyJunge1 wants to merge 2 commits into
jniebuhr:masterfrom
EyJunge1:fix/profile-picker-favorites

Conversation

@EyJunge1

@EyJunge1 EyJunge1 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Rebuild the display profile picker list from favorites plus all profiles in stable profile order.
  • Start the picker on the currently selected profile instead of always index 0.
  • Keep the "Current profile" label tied to the selected profile id and guard empty/out-of-range picker state.

Fixes #701

Test plan

Summary by CodeRabbit

  • New Features

    • Profiles list now combines favorites with available profiles and reloads when switching, keeping the selected profile highlighted.
  • Bug Fixes

    • Stronger bounds checks and default initialization prevent empty-state and out-of-range errors.
    • Profile labels and "next profile" control now correctly reflect available profiles and disable when at the end.

@cla-bot

cla-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have yours on file. In order for us to review and merge your code, please contact @jniebuhr (mdwasp) on Discord to get yourself added.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 05f24ba6-c658-426f-96d1-06c0e5152db7

📥 Commits

Reviewing files that changed from the base of the PR and between a0fd5a6 and a3d7ff9.

📒 Files selected for processing (1)
  • src/display/ui/default/DefaultUI.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/display/ui/default/DefaultUI.cpp

📝 Walkthrough

Walkthrough

Rebuilds the profile ID list by merging favorites with all profiles, initializes currentProfileIdx to 0, reloads profiles before switching screens, and adds defensive bounds checks to navigation and profile-screen rendering.

Changes

Profile picker navigation and rendering safety

Layer / File(s) Summary
Data initialization and dependencies
src/display/ui/default/DefaultUI.h, src/display/ui/default/DefaultUI.cpp
currentProfileIdx initialized to 0 and <iterator> header added to support de-duplication in the refactored profile list construction.
Profile list construction with deduplication
src/display/ui/default/DefaultUI.cpp
loopProfiles() rebuilds the backing ID list by merging favoritedIds with the full listProfiles() result, de-duplicating, reserving capacity, loading profiles for merged IDs, and initializing currentProfileIdx by matching the controller-selected profile id.
Navigation flow and bounds checking
src/display/ui/default/DefaultUI.cpp
onProfileSwitch() reloads profiles before switching screens; onNextProfile() advances only when the list is non-empty and index < size - 1; onProfileSelect() early-returns when the favorites list is empty or currentProfileIdx is out-of-range.
Profile screen rendering with guards
src/display/ui/default/DefaultUI.cpp
Profile screen update logic checks for empty or out-of-range currentProfileIdx before accessing favoritedProfiles, populates UI labels/values from the selected profile object, and derives "current vs select" from profile.id == selectedProfileId.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through lists both near and far,
Merged favorites with the full profile tar,
Bounds checked every leap and stride,
Now back-and-forth works just right,
A merry picker, safe, on par.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing navigation issues in the small-screen profile picker.
Linked Issues check ✅ Passed The code changes directly address all requirements from issue #701: rebuilding the profile list from favorites plus all profiles, starting on the selected profile, keeping navigation through all profiles, and guarding against empty/out-of-range states.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the profile picker navigation issue; the addition of <iterator> header and initialization of currentProfileIdx are necessary supporting changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EyJunge1

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Jun 10, 2026
@cla-bot

cla-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

…lection

Build the picker list in stable profile order (favorites first, then all
profiles) and position the cursor on the currently selected profile instead
of always resetting to index 0. Fixes jniebuhr#701.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EyJunge1
EyJunge1 force-pushed the fix/profile-picker-favorites branch from 9eca2c1 to a0fd5a6 Compare June 10, 2026 12:24
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Small-screen profile picker hides favorites after selecting a non-favorite

1 participant