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.)
This commit is contained in:
Augustin Cavalier
2018-12-22 00:36:30 -05:00
parent 588a0c9f67
commit 52a022f201
+3 -3
View File
@@ -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) {