improve the genlist code a bit further

svn path=/trunk/; revision=31961
This commit is contained in:
Christoph von Wittich 2008-01-23 17:14:08 +00:00
parent d06204ede8
commit 7fd698ea9a

View file

@ -21,6 +21,7 @@
* FILE: subsys/system/usetup/genlist.c
* PURPOSE: Generic list functions
* PROGRAMMER: Eric Kohl
* Christoph von Wittich <christoph at reactos.org>
*/
/* 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;
}