fix(windows): prevent dark menubar item text truncation#357
Merged
amrbashir merged 1 commit intoMay 20, 2026
Conversation
amrbashir
reviewed
May 19, 2026
amrbashir
left a comment
Member
There was a problem hiding this comment.
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.
9f213a7 to
bef2e7a
Compare
Contributor
Author
|
Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:

After:
