From 7fd698ea9a6478c40d27965609f25e4e67c9694a Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Wed, 23 Jan 2008 17:14:08 +0000 Subject: [PATCH] improve the genlist code a bit further svn path=/trunk/; revision=31961 --- reactos/base/setup/usetup/genlist.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/reactos/base/setup/usetup/genlist.c b/reactos/base/setup/usetup/genlist.c index e1300a2ca4e..17fb7d31c4b 100644 --- a/reactos/base/setup/usetup/genlist.c +++ b/reactos/base/setup/usetup/genlist.c @@ -21,6 +21,7 @@ * FILE: subsys/system/usetup/genlist.c * PURPOSE: Generic list functions * PROGRAMMER: Eric Kohl + * Christoph von Wittich */ /* INCLUDES *****************************************************************/ @@ -318,17 +319,30 @@ GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar) PGENERIC_LIST_ENTRY ListEntry; PLIST_ENTRY Entry; - Entry = GenericList->ListHead.Flink; + Entry = &GenericList->CurrentEntry->Entry; + ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + +Reset: + + if (tolower(ListEntry->Text[0]) != AsciChar) + Entry = GenericList->ListHead.Flink; + while (Entry != &GenericList->ListHead) { ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - if (strlen(ListEntry->Text) > 0) + if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar)) { - if (tolower(ListEntry->Text[0]) == AsciChar) + if (CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry) == GenericList->CurrentEntry) { - GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - break; + Entry = Entry->Flink; + if (Entry == &GenericList->ListHead) + goto Reset; + ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + if ((strlen(ListEntry->Text) < 1) || (tolower(ListEntry->Text[0]) != AsciChar)) + goto Reset; } + GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + break; } Entry = Entry->Flink; }