From 52a022f201cb937d92af9c60e33d6739bc31bfbc Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 22 Dec 2018 00:36:30 -0500 Subject: [PATCH] BMenu: Accept any alphanumeric ASCII character on the first trigger pass. Since we use sentence-cased menus, there is probably only one capital letter in the line, so looking for only capitals won't be very useful. Instead, accept any ASCII character (< 255) which is alphanumeric, as these are more likely to be command-able in any given keymap. (IsAlNum returns true for accented Latin characters also, which may be un-command-able if they require dead keys to type.) --- src/kits/interface/Menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 83d6d7e597..b62ac43ca4 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -2879,11 +2879,11 @@ BMenu::_ChooseTrigger(const char* title, int32& index, uint32& trigger, uint32 c; const char* nextCharacter, *character; - // two runs: first we look out for uppercase letters + // two runs: first we look out for alphanumeric ASCII characters nextCharacter = title; character = nextCharacter; while ((c = BUnicodeChar::FromUTF8(&nextCharacter)) != 0) { - if (!BUnicodeChar::IsUpper(c) || triggers.HasTrigger(c)) { + if (!(c < 255 && BUnicodeChar::IsAlNum(c)) || triggers.HasTrigger(c)) { character = nextCharacter; continue; } @@ -2892,7 +2892,7 @@ BMenu::_ChooseTrigger(const char* title, int32& index, uint32& trigger, return triggers.AddTrigger(c); } - // then, if we still haven't found anything, we accept them all + // then, if we still haven't found something, we accept anything nextCharacter = title; character = nextCharacter; while ((c = BUnicodeChar::FromUTF8(&nextCharacter)) != 0) {