Repository: microsoft/terminal
File: src/cascadia/WindowsTerminal/TrayIcon.cpp (C++)

Code before:
        mi.cbSize = sizeof(MENUINFO);
        mi.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS | MIM_MENUDATA;
        mi.dwStyle = MNS_NOTIFYBYPOS;
        mi.dwMenuData = NULL;
        SetMenuInfo(hMenu, &mi);

        // Focus Current Terminal Window
        AppendMenu(hMenu, MF_STRING, gsl::narrow<UINT_PTR>(TrayMenuItemAction::FocusTerminal), RS_(L"TrayIconFocusTerminal").c_str());
        AppendMenu(hMenu, MF_SEPARATOR, 0, L"");

        // Submenu for Windows
        if (auto submenu = CreatePopupMenu())
        {
            for (const auto& p : peasants)
            {
                std::wstringstream displayText;
                displayText << "#" << p.Id;

                if (!p.TabTitle.empty())
                {
                    displayText << ":" << p.TabTitle.c_str();
                }

                if (!p.Name.empty())
                {
                    displayText << " [" << p.Name.c_str() << "]";
                }

                AppendMenu(submenu, MF_STRING, gsl::narrow<UINT_PTR>(p.Id), displayText.str().c_str());
            }

            MENUINFO submenuInfo{};
            submenuInfo.cbSize = sizeof(MENUINFO);
            submenuInfo.fMask = MIM_MENUDATA;
            submenuInfo.dwStyle = MNS_NOTIFYBYPOS;
            submenuInfo.dwMenuData = (UINT_PTR)TrayMenuItemAction::SummonWindow;
            SetMenuInfo(submenu, &submenuInfo);

            AppendMenu(hMenu, MF_POPUP, (UINT_PTR)submenu, RS_(L"TrayIconWindowSubmenu").c_str());
        }
    }
    return hMenu;
}

// Method Description:
// - This is the handler for when one of the menu items are selected within
//   the tray icon's context menu.
// Arguments:
// - menu: The handle to the menu that holds the menu item that was selected.
// - menuItemIndex: The index of the menu item within the given menu.
// Return Value:

Review comment (suggestion):
```suggestion
                    displayText << " [" << std::wstring_view{ p.Name } << "]";
```

Code after:
        mi.cbSize = sizeof(MENUINFO);
        mi.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS | MIM_MENUDATA;
        mi.dwStyle = MNS_NOTIFYBYPOS;
        mi.dwMenuData = NULL;
        SetMenuInfo(hMenu, &mi);

        // Focus Current Terminal Window
        AppendMenu(hMenu, MF_STRING, gsl::narrow<UINT_PTR>(TrayMenuItemAction::FocusTerminal), RS_(L"TrayIconFocusTerminal").c_str());
        AppendMenu(hMenu, MF_SEPARATOR, 0, L"");

        // Submenu for Windows
        if (auto submenu = CreatePopupMenu())
        {
            for (const auto& p : peasants)
            {
                std::wstringstream displayText;
                displayText << L"#" << p.Id;

                if (!p.TabTitle.empty())
                {
                    displayText << L": " << std::wstring_view{ p.TabTitle };
                }

                if (!p.Name.empty())
                {
                    displayText << L" [" << std::wstring_view{ p.Name } << L"]";
                }

                AppendMenu(submenu, MF_STRING, gsl::narrow<UINT_PTR>(p.Id), displayText.str().c_str());
            }

            MENUINFO submenuInfo{};
            submenuInfo.cbSize = sizeof(MENUINFO);
            submenuInfo.fMask = MIM_MENUDATA;
            submenuInfo.dwStyle = MNS_NOTIFYBYPOS;
            submenuInfo.dwMenuData = (UINT_PTR)TrayMenuItemAction::SummonWindow;
            SetMenuInfo(submenu, &submenuInfo);

            AppendMenu(hMenu, MF_POPUP, (UINT_PTR)submenu, RS_(L"TrayIconWindowSubmenu").c_str());
        }
    }
    return hMenu;
}

// Method Description:
// - This is the handler for when one of the menu items are selected within
//   the tray icon's context menu.
// Arguments:
// - menu: The handle to the menu that holds the menu item that was selected.
// - menuItemIndex: The index of the menu item within the given menu.
// Return Value: