Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: select last entry if pointer/touch above last index #332

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

stacyharper
Copy link
Contributor

No description provided.

lib/menu.c Outdated
@@ -677,7 +677,7 @@ bm_menu_set_highlighted_index(struct bm_menu *menu, uint32_t index)
bm_menu_get_filtered_items(menu, &count);

if (count <= index)
return 0;
index = count - 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can fail badly if count is 0

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe (count > 0 ? count - 1 : 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@stacyharper
Copy link
Contributor Author

I also added another minor patch to select the first entry if pointer/touch above the title line. I think it make things more consistent.

@Cloudef Cloudef merged commit 0c0107e into Cloudef:master Feb 22, 2023
@Cloudef
Copy link
Owner

Cloudef commented Feb 22, 2023

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants