From b3cdf92238b057e8cf12c6d9e292539abf4ea48f Mon Sep 17 00:00:00 2001 From: penfold42 Date: Wed, 1 Aug 2018 00:53:31 +1000 Subject: [PATCH] Oops... a-z code was in BrowsableListView::CheckNavigation. With 2 screens it was running ttwwiiccee Moved to BrowsableList::CheckNavigation --- src/FileBrowser.cpp | 83 +++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/src/FileBrowser.cpp b/src/FileBrowser.cpp index 518fd6c..219d1b3 100644 --- a/src/FileBrowser.cpp +++ b/src/FileBrowser.cpp @@ -308,46 +308,6 @@ bool FileBrowser::BrowsableListView::CheckBrowseNavigation(bool pageOnly) dirty = true; } - // check for keys a-z - if (inputMappings->BrowseLetter()) - { - char temp[8]; - unsigned found=0; - u32 i=0; - snprintf (temp, sizeof(temp), "%c", inputMappings->getKeyboardLetter()); - - // first look from next to last - for (i=1+list->currentIndex; i <= numberOfEntriesMinus1 ; i++) - { - FileBrowser::BrowsableList::Entry* entry = &list->entries[i]; - if (strncasecmp(temp, entry->filImage.fname, 1) == 0) - { - found=i; - break; - } - } - if (!found) - { - // look from first to previous - for (i=0; i< 1+list->currentIndex ; i++) - { - FileBrowser::BrowsableList::Entry* entry = &list->entries[i]; - if (strncasecmp(temp, entry->filImage.fname, 1) == 0) - { - found=i; - break; - } - } - } - - if (found) - { - list->currentIndex=found; - list->SetCurrent(); - dirty = true; - } - } - return dirty; } @@ -381,12 +341,55 @@ void FileBrowser::BrowsableList::RefreshViewsHighlightScroll() bool FileBrowser::BrowsableList::CheckBrowseNavigation() { + InputMappings* inputMappings = InputMappings::Instance(); + u32 numberOfEntriesMinus1 = entries.size() - 1; + bool dirty = false; u32 index; for (index = 0; index < views.size(); ++index) { dirty |= views[index].CheckBrowseNavigation(index != 0); } + // check for keys a-z + if (inputMappings->BrowseLetter()) + { + char temp[8]; + unsigned found=0; + u32 i=0; + snprintf (temp, sizeof(temp), "%c", inputMappings->getKeyboardLetter()); + + // first look from next to last + for (i=1+currentIndex; i <= numberOfEntriesMinus1 ; i++) + { + FileBrowser::BrowsableList::Entry* entry = &entries[i]; + if (strncasecmp(temp, entry->filImage.fname, 1) == 0) + { + found=i; + break; + } + } + if (!found) + { + // look from first to previous + for (i=0; i< 1+currentIndex ; i++) + { + FileBrowser::BrowsableList::Entry* entry = &entries[i]; + if (strncasecmp(temp, entry->filImage.fname, 1) == 0) + { + found=i; + break; + } + } + } + + if (found) + { + currentIndex=found; + SetCurrent(); + dirty |= 1; + } + } + return dirty; }