mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Improve MENU_NAVIGATION_CTL_ASCEND_ALPHABET - can no longer
get out of bounds, will now properly scroll down to end of list if it can not jump alphabetically to the next letter and there is still space to go to the end of the list
This commit is contained in:
parent
b82f4daae9
commit
31c1f31299
@ -142,7 +142,9 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
||||
case MENU_NAVIGATION_CTL_ASCEND_ALPHABET:
|
||||
{
|
||||
size_t i = 0, ptr;
|
||||
size_t *ptr_out = (size_t*)&selection_ptr;
|
||||
bool scrolled_down = false;
|
||||
size_t *ptr_out = (size_t*)&selection_ptr;
|
||||
size_t menu_list_size = menu_entries_get_size();
|
||||
|
||||
if (!scroll_index.size || !ptr_out)
|
||||
return false;
|
||||
@ -150,13 +152,20 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
||||
ptr = *ptr_out;
|
||||
|
||||
if (ptr == scroll_index.list[scroll_index.size - 1])
|
||||
return false;
|
||||
{
|
||||
*ptr_out = menu_list_size - 1;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_ASCEND_ALPHABET, ptr_out);
|
||||
return true;
|
||||
}
|
||||
|
||||
while (i < scroll_index.size - 1
|
||||
&& scroll_index.list[i + 1] <= ptr)
|
||||
i++;
|
||||
*ptr_out = scroll_index.list[i + 1];
|
||||
|
||||
if (*ptr_out >= menu_list_size)
|
||||
*ptr_out = menu_list_size - 1;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_ASCEND_ALPHABET, ptr_out);
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user