summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-05-30 08:29:44 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-05-30 08:29:44 +0000
commit5983e7fa42ac26cef567b123104570054f5ca72a (patch)
tree7a978ff1425e91785fd0d6f5fbc7bc6d56d42fa6
parent155e3d33d602e5aa440d785fb774ae711fae0e1a (diff)
few more list anomolys fixed..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13521 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/list.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 18b49f64ac..1764ba48eb 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -169,7 +169,15 @@ static void gui_list_put_selection_in_screen(struct gui_list * gui_list,
int nb_lines=gui_list->display->nb_lines;
if (SHOW_LIST_TITLE)
nb_lines--;
- if(put_from_end)
+ if (gui_list->nb_items < nb_lines)
+ {
+ gui_list->start_item = 0;
+ }
+ else if (gui_list->nb_items - gui_list->selected_item < nb_lines)
+ {
+ gui_list->start_item = gui_list->nb_items - nb_lines;
+ }
+ else if(put_from_end)
{
int list_end = gui_list->selected_item + SCROLL_LIMIT;
if(list_end >= gui_list->nb_items)
@@ -562,6 +570,8 @@ static void gui_list_select_at_offset(struct gui_list * gui_list, int offset)
if (gui_list->selected_item - gui_list->start_item >= nb_lines)
{
gui_list->start_item = gui_list->selected_item;
+ if (gui_list->nb_items - gui_list->start_item < nb_lines)
+ gui_list->start_item = gui_list->nb_items - nb_lines;
}
}
else if (nb_lines - (gui_list->selected_item - gui_list->start_item) <= SCROLL_LIMIT)