From c4c678ff1a66c99b5484341dccded3bf1873912d Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Mon, 21 Jan 2008 22:28:25 +0000 Subject: [PATCH] Accept FS #8490 by Vuong Minh Hiep: fix wrong selection in multi-line lists git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16135 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 16 ++++++---------- docs/CREDITS | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/gui/list.c b/apps/gui/list.c index 5ae400e24a..cfb1e7c073 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -550,26 +550,23 @@ void gui_synclist_select_item(struct gui_synclist * gui_list, int item_number) static void gui_list_select_at_offset(struct gui_synclist * gui_list, int offset) { - int new_selection = gui_list->selected_item + offset; + int new_selection; if (gui_list->selected_size > 1) { offset *= gui_list->selected_size; /* always select the first item of multi-line lists */ offset -= offset%gui_list->selected_size; } + new_selection = gui_list->selected_item + offset; if (new_selection >= gui_list->nb_items) { - if (gui_list->limit_scroll) - gui_list->selected_item = gui_list->nb_items - 1; - else - gui_list->selected_item = new_selection - gui_list->nb_items; + gui_list->selected_item = gui_list->limit_scroll ? + gui_list->nb_items - gui_list->selected_size : 0; } else if (new_selection < 0) { - if (gui_list->limit_scroll) - gui_list->selected_item = 0; - else - gui_list->selected_item = new_selection + gui_list->nb_items; + gui_list->selected_item = gui_list->limit_scroll ? + 0 : gui_list->nb_items - gui_list->selected_size; } else if (gui_list->show_selection_marker == false) { @@ -599,7 +596,6 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, } else gui_list->selected_item += offset; gui_synclist_select_item(gui_list, gui_list->selected_item); - } /* diff --git a/docs/CREDITS b/docs/CREDITS index 549b4467a8..24d58e433b 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -366,6 +366,7 @@ Thomas Martitz Prakarn Sahasoontornvute George Tamplaru Apoorva Mahajan +Vuong Minh Hiep The libmad team The wavpack team