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:
@@ -245,13 +245,16 @@ BMenuItem::SetTrigger(char trigger)
|
|||||||
// try uppercase letters first
|
// try uppercase letters first
|
||||||
|
|
||||||
const char* pos = strchr(Label(), toupper(trigger));
|
const char* pos = strchr(Label(), toupper(trigger));
|
||||||
|
trigger = tolower(trigger);
|
||||||
|
|
||||||
if (pos == NULL) {
|
if (pos == NULL) {
|
||||||
// take lowercase, too
|
// take lowercase, too
|
||||||
pos = strchr(Label(), trigger);
|
pos = strchr(Label(), trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos != NULL) {
|
if (pos != NULL) {
|
||||||
fTriggerIndex = UTF8CountChars(Label(), pos - Label());
|
fTriggerIndex = UTF8CountChars(Label(), pos - Label());
|
||||||
fTrigger = tolower(UTF8ToCharCode(&pos));
|
fTrigger = trigger;
|
||||||
} else {
|
} else {
|
||||||
fTrigger = 0;
|
fTrigger = 0;
|
||||||
fTriggerIndex = -1;
|
fTriggerIndex = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user