From 7b07ccb44d239b36fca9411aa2e949dac2d704ba Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 9 May 2022 20:21:39 +0200 Subject: [PATCH] Fixed an issue where the 'Jump to..' quick selector wouldn't work correctly for multi-byte Unicode characters. --- es-app/src/guis/GuiGamelistOptions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index 791a3247f..cab1d1995 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -488,16 +488,16 @@ void GuiGamelistOptions::openMetaDataEd() void GuiGamelistOptions::jumpToLetter() { - char letter {mJumpToLetterList->getSelected().front()}; + std::string letter {Utils::String::getFirstCharacter(mJumpToLetterList->getSelected())}; // Get the gamelist. - const std::vector& files = - getGamelist()->getCursor()->getParent()->getChildrenListToDisplay(); + const std::vector& files { + getGamelist()->getCursor()->getParent()->getChildrenListToDisplay()}; for (unsigned int i = 0; i < files.size(); ++i) { if (mFavoritesSorting && (mFirstLetterIndex.front() == ViewController::FAVORITE_CHAR || mFirstLetterIndex.front() == ViewController::FOLDER_CHAR)) { - if (static_cast(toupper(files.at(i)->getSortName().front())) == letter && + if (Utils::String::getFirstCharacter(files.at(i)->getSortName()) == letter && !files.at(i)->getFavorite()) { if (!mOnlyHasFolders && mFoldersOnTop && files.at(i)->getType() == FOLDER) { continue; @@ -509,7 +509,7 @@ void GuiGamelistOptions::jumpToLetter() } } else { - if (static_cast(toupper(files.at(i)->getSortName().front())) == letter) { + if (Utils::String::getFirstCharacter(files.at(i)->getSortName()) == letter) { if (!mOnlyHasFolders && mFoldersOnTop && files.at(i)->getType() == FOLDER) { continue; }