From 3e39b122d7445fbd7f9ad3a42115b9016c621a1e Mon Sep 17 00:00:00 2001 From: Don Honerbrink Date: Fri, 29 May 2015 20:04:13 +0000 Subject: [PATCH] letter scrolling now groups all non alphanumeric characters --- .../Source/Graphics/Component/ScrollingList.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index e85c7ef..511cbbf 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -388,8 +388,6 @@ void ScrollingList::LetterUp() if(SpriteList && ScrollPoints) { - - unsigned int i = 0; // Select the previous item in the list in case we are at the top of all the items @@ -406,8 +404,10 @@ void ScrollingList::LetterUp() CircularDecrement(FirstSpriteIndex, SpriteList); std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); ++i; - done = (startname[0] != endname[0]); - + + // check if we are changing characters from a-z, or changing from alpha character to non-alpha character + done = (isalpha(startname[0]) ^ isalpha(endname[0])) || (isalpha(startname[0]) && isalpha(endname[0]) && startname[0] != endname[0])); + if(done) { // our searching went too far, rewind to the first item in the list that matches the starting letter @@ -431,12 +431,15 @@ void ScrollingList::LetterDown() std::string endname = startname; unsigned int i = 0; - - while(startname[0] == endname[0] && i < SpriteList->size()) + bool done = false; + while(!done && i < SpriteList->size()) { CircularIncrement(FirstSpriteIndex, SpriteList); endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); ++i; + + // check if we are changing characters from a-z, or changing from alpha character to non-alpha character + done = (isalpha(startname[0]) ^ isalpha(endname[0])) || (isalpha(startname[0]) && isalpha(endname[0]) && startname[0] != endname[0])); } }