1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

WindowServer: Strip Alt-shortcut marker ('&') when measuring menu texts

We were including these markers when computing the sizes of menus,
causing them to get a little too much padding.
This commit is contained in:
Andreas Kling 2021-04-12 15:24:17 +02:00
parent fbbb4b3395
commit 767bd8cc88
2 changed files with 2 additions and 2 deletions

View file

@ -115,7 +115,7 @@ int Menu::content_width() const
if (item.type() != MenuItem::Text)
continue;
auto& use_font = item.is_default() ? Gfx::FontDatabase::default_bold_font() : font();
int text_width = use_font.width(item.text());
int text_width = use_font.width(Gfx::parse_ampersand_string(item.text()));
if (!item.shortcut_text().is_empty()) {
int shortcut_width = use_font.width(item.shortcut_text());
widest_shortcut = max(shortcut_width, widest_shortcut);