Oops... a-z code was in BrowsableListView::CheckNavigation.

With 2 screens it was running ttwwiiccee
Moved to BrowsableList::CheckNavigation
This commit is contained in:
penfold42 2018-08-01 00:53:31 +10:00
parent df58673e65
commit b3cdf92238

View file

@ -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;
}