Simplify the SetTrigger() code. The trigger is a single byte char anyway, so no
need to convert the looked up label position to a char code. Also actually make sure that the trigger is lower case by doing an explicit tolower() instead of assuming that it already is. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36316 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bae33cdad5
commit
1da48c4149
@ -245,13 +245,16 @@ BMenuItem::SetTrigger(char trigger)
|
||||
// try uppercase letters first
|
||||
|
||||
const char* pos = strchr(Label(), toupper(trigger));
|
||||
trigger = tolower(trigger);
|
||||
|
||||
if (pos == NULL) {
|
||||
// take lowercase, too
|
||||
pos = strchr(Label(), trigger);
|
||||
}
|
||||
|
||||
if (pos != NULL) {
|
||||
fTriggerIndex = UTF8CountChars(Label(), pos - Label());
|
||||
fTrigger = tolower(UTF8ToCharCode(&pos));
|
||||
fTrigger = trigger;
|
||||
} else {
|
||||
fTrigger = 0;
|
||||
fTriggerIndex = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user