letter scrolling now groups all non alphanumeric characters

This commit is contained in:
Don Honerbrink 2015-05-29 20:04:13 +00:00
parent 846e1228dd
commit 3e39b122d7

View File

@ -388,8 +388,6 @@ void ScrollingList::LetterUp()
if(SpriteList && ScrollPoints) if(SpriteList && ScrollPoints)
{ {
unsigned int i = 0; unsigned int i = 0;
// Select the previous item in the list in case we are at the top of all the items // Select the previous item in the list in case we are at the top of all the items
@ -406,7 +404,9 @@ void ScrollingList::LetterUp()
CircularDecrement(FirstSpriteIndex, SpriteList); CircularDecrement(FirstSpriteIndex, SpriteList);
std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle();
++i; ++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) if(done)
{ {
@ -431,12 +431,15 @@ void ScrollingList::LetterDown()
std::string endname = startname; std::string endname = startname;
unsigned int i = 0; unsigned int i = 0;
bool done = false;
while(startname[0] == endname[0] && i < SpriteList->size()) while(!done && i < SpriteList->size())
{ {
CircularIncrement(FirstSpriteIndex, SpriteList); CircularIncrement(FirstSpriteIndex, SpriteList);
endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle();
++i; ++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]));
} }
} }