Skip to content

fix(windows): prevent dark menubar item text truncation#357

Merged
amrbashir merged 1 commit into
tauri-apps:devfrom
mattico:fix-win-dark-menu-bar-truncated
May 20, 2026
Merged

fix(windows): prevent dark menubar item text truncation#357
amrbashir merged 1 commit into
tauri-apps:devfrom
mattico:fix-win-dark-menu-bar-truncated

Conversation

@mattico

@mattico mattico commented May 19, 2026

Copy link
Copy Markdown
Contributor

The dark menubar draw path fetched menu item text with an incorrectly sized UTF-16 buffer, which truncated top-level labels during custom drawing in dark mode. Previously it used size_of_val(&label), which returned the size of the Vec struct itself rather than its contents and limited retrieval to about 10 UTF-16 code units on 64-bit Windows.

Use the standard two-step GetMenuItemInfoW pattern: first query the required string length, then allocate a buffer large enough for the full label plus the trailing null terminator before fetching the text.

Also returns early if either Win32 call fails so the draw path skips the label instead of using incomplete data.

Before:
image

After:
image

@amrbashir amrbashir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, can you please add a change file in .changes directory?

The dark menubar draw path fetched menu item text with an incorrectly
sized UTF-16 buffer, which truncated top-level labels during custom
drawing in dark mode. Previously it used `size_of_val(&label)`, which
returned the size of the Vec struct itself rather than its contents and
limited retrieval to about 11 UTF-16 code units on 64-bit Windows.

Use the standard two-step GetMenuItemInfoW pattern: first query the
required string length, then allocate a buffer large enough for the
full label plus the trailing null terminator before fetching the text.

Also returns early if either Win32 call fails so the draw path skips the label
instead of using incomplete data.
@mattico mattico force-pushed the fix-win-dark-menu-bar-truncated branch from 9f213a7 to bef2e7a Compare May 20, 2026 03:11
@mattico

mattico commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Done!

@amrbashir amrbashir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@amrbashir amrbashir merged commit 51fde8e into tauri-apps:dev May 20, 2026
10 checks passed
@mattico mattico deleted the fix-win-dark-menu-bar-truncated branch May 20, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants