Ticket #1506 (closed bug: fixed)

Opened 16 months ago

Last modified 15 months ago

BMenuItem's trigger is drawn at incorrect position.

Reported by: hiron Owned by: axeld
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1 development
Cc: Blocked By:
Platform: All Blocking:

Description

On Haiku, BMenuItem's searching trigger character in its label is case-sensitive. On BeOS R5, it is case-insensitive. To reproduce:

BMenuItem* item = new BMenuItem("Quit", NULL);
item->SetTrigger('q');

This menu item draws no trigger underline on Haiku against that the first character (Q) is underlined on BeOS R5.

And if there are multi-byte characters, it fails to locate a correct position. To reproduce:

// "\xe3\x81\x82" is a Japanese hiragana letter A (U+3042) (single character)
BMenuItem* item = new BMenuItem("\xe3\x81\x82haiku", NULL);
item->SetTrigger('h');

The trigger underline is drawn under 'i', of course the expected behavior is it draws under 'h'. (Even though BeOS R5 has a same bug...)

It seems that in BMenuItem::DrawContent,

font.GetEscapements(fLabel, fTriggerIndex + 1, escapements);

fTriggerIndex has an index in bytes but BFont::GetEscapements takes a number of characters, not bytes.

Change History

Changed 16 months ago by axeld

  • status changed from new to assigned

Changed 16 months ago by axeld

  • status changed from assigned to closed
  • resolution set to fixed

Thanks for the report. It's fixed in r22384.

Changed 15 months ago by hiron

  • status changed from closed to reopened
  • resolution fixed deleted

The latter one is not fixed yet. fTriggerIndex still holds a byte position.

In BMenuItem::SetTrigger(char)

fTriggerIndex = pos - Label();

Changed 15 months ago by axeld

  • status changed from reopened to closed
  • resolution set to fixed

Thanks a lot for retesting! It's fixed now in r22476.

Note: See TracTickets for help on using tickets.