Search: Skip spaces and control characters, code cleanup, fix minor issue on desktop

This commit is contained in:
Henrik Rydgård
2026-05-11 11:05:36 +02:00
parent 3f0fa315b2
commit bc9a047ef1
4 changed files with 8 additions and 7 deletions
+6
View File
@@ -387,7 +387,13 @@ std::string NormalizeForSearch(std::string_view input) {
while (index < size) {
uint32_t codepoint = u8_nextchar(input.data(), &index, size);
// Skip spaces and control characters.
if (codepoint <= 0x20) {
continue;
}
// 1. Convert Fullwidth Roman/Numbers to ASCII
// These are common in Japanese game names.
// Range: U+FF01 () to U+FF5E ()
if (codepoint >= 0xFF01 && codepoint <= 0xFF5E) {
codepoint -= 0xFEE0;
+1
View File
@@ -212,6 +212,7 @@ void UpdateNativeMenuKeys() {
RemoveKeyboardLetterKeys(tabRight);
RemoveKeyboardLetterKeys(confirmKeys);
RemoveKeyboardLetterKeys(cancelKeys);
RemoveKeyboardLetterKeys(infoKeys);
SetDPadKeys(upKeys, downKeys, leftKeys, rightKeys);
SetConfirmCancelKeys(confirmKeys, cancelKeys);
+1 -6
View File
@@ -515,18 +515,13 @@ void MainScreen::CreateViews() {
bool MainScreen::key(const KeyInput &key) {
if (key.flags & KeyInputFlags::DOWN) {
if (key.keyCode == NKCODE_CTRL_LEFT || key.keyCode == NKCODE_CTRL_RIGHT)
searchKeyModifier_ = true;
if (key.keyCode == NKCODE_F && searchKeyModifier_ && System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
if (key.keyCode == NKCODE_F && (key.flags & KeyInputFlags::MOD_CTRL) && System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
auto se = GetI18NCategory(I18NCat::SEARCH);
System_InputBoxGetString(GetRequesterToken(), se->T("Search term"), searchFilter_, false, [&](const std::string &value, int) {
searchFilter_ = StripSpaces(value);
searchChanged_ = true;
});
}
} else if (key.flags & KeyInputFlags::UP) {
if (key.keyCode == NKCODE_CTRL_LEFT || key.keyCode == NKCODE_CTRL_RIGHT)
searchKeyModifier_ = false;
}
bool retval = UIBaseScreen::key(key);
-1
View File
@@ -92,7 +92,6 @@ protected:
bool lockBackgroundAudio_ = false;
bool lastVertical_ = false;
bool confirmedTemporary_ = false;
bool searchKeyModifier_ = false;
bool searchChanged_ = false;
std::string searchFilter_;