-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Microsoft PowerToys version
0.93.0
Installation method
PowerToys auto-update
Area(s) with issue?
Command Palette
Steps to reproduce
winrt::Microsoft::Terminal::UI::implementation::IconPathConverter and Microsoft.CmdPal.UI.Controls.IconBox treat anything longer than 2 UTF-16 code units as “not an emoji,” so multi-codepoint emoji/grapheme clusters get ignored. The check looks like this:
PowerToys/src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.cpp
Lines 170 to 180 in 377d134
| // If we fail to set the icon source using the "icon" as a path, | |
| // let's try it as a symbol/emoji. | |
| // | |
| // Anything longer than 2 wchar_t's _isn't_ an emoji or symbol, so | |
| // don't do this if it's just an invalid path. | |
| if (!iconSource && iconPath.size() <= 2) | |
| { | |
| try | |
| { | |
| typename FontIconSource<TIconSource>::type icon; | |
| const auto ch = til::at(iconPath, 0); |
PowerToys/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconBox.cs
Lines 145 to 150 in 377d134
| if (iconData is not null && | |
| @this.Source is FontIconSource) | |
| { | |
| if (!string.IsNullOrEmpty(iconData.Icon) && iconData.Icon.Length <= 2) | |
| { | |
| var ch = iconData.Icon[0]; |
Why this breaks:
Lots of emoji are grapheme clusters (multiple code points), e.g. family emojis, skin tones, gendered professions (🧙♂️ “man mage”), flags, etc.
E.g. 🧙♂️ has 4 codepoints: U+1F9D9 U+200D U+2642 U+FE0F
Those are a single user-perceived character but >2 wchar_ts, so they fail the length check.
https://github.com/microsoft/terminal/blob/main/src/types/CodepointWidthDetector.cpp
