From: Dmitry Chapyshev Date: Tue, 17 Jun 2008 20:10:07 +0000 (+0000) Subject: - Add correct scrolling by keypress X-Git-Tag: ReactOS-0.3.5~113 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=10ea44c612ef04a41643dda0817fa5c348d052f8 - Add correct scrolling by keypress svn path=/trunk/; revision=34002 --- diff --git a/reactos/base/setup/usetup/genlist.c b/reactos/base/setup/usetup/genlist.c index ea3f2fb8e38..464c8bdfddc 100644 --- a/reactos/base/setup/usetup/genlist.c +++ b/reactos/base/setup/usetup/genlist.c @@ -538,42 +538,59 @@ VOID GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar) { PGENERIC_LIST_ENTRY ListEntry; - PLIST_ENTRY Entry; - - Entry = &GenericList->CurrentEntry->Entry; - ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + PGENERIC_LIST_ENTRY OldListEntry; + BOOLEAN Flag = FALSE; -Reset: + ListEntry = GenericList->CurrentEntry; + OldListEntry = GenericList->CurrentEntry; - if (tolower(ListEntry->Text[0]) != AsciChar) - Entry = GenericList->ListHead.Flink; + GenericList->Redraw = FALSE; - while (Entry != &GenericList->ListHead) + if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar) && + (GenericList->CurrentEntry->Entry.Flink != &GenericList->ListHead)) { - ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + ScrollDownGenericList(GenericList); + ListEntry = GenericList->CurrentEntry; if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar)) - { - if (CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry) == GenericList->CurrentEntry) - { - Entry = Entry->Flink; - if (Entry == &GenericList->ListHead) - goto Reset; + goto End; + } - ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - if ((strlen(ListEntry->Text) < 1) || (tolower(ListEntry->Text[0]) != AsciChar)) - goto Reset; - } + while (GenericList->CurrentEntry->Entry.Blink != &GenericList->ListHead) + ScrollUpGenericList(GenericList); - GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + ListEntry = GenericList->CurrentEntry; + + for (;;) + { + if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar)) + { + Flag = TRUE; break; } - Entry = Entry->Flink; + if (GenericList->CurrentEntry->Entry.Flink == &GenericList->ListHead) + break; + + ScrollDownGenericList(GenericList); + ListEntry = GenericList->CurrentEntry; + } + + if (!Flag) + { + while (GenericList->CurrentEntry->Entry.Blink != &GenericList->ListHead) + { + if (GenericList->CurrentEntry != OldListEntry) + ScrollUpGenericList(GenericList); + else + break; + } } +End: + DrawListEntries(GenericList); + DrawScrollBarGenericList(GenericList); - if (Entry) - DrawListEntries(GenericList); + GenericList->Redraw = TRUE; }