mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-24 23:59:08 +02:00
Win32 swallows a lone & in an MFT_STRING menu item as the mnemonic prefix, so "Help & Support" rendered as "Help Support". Add a build-tagged menuLabel() helper that doubles & to && on Windows and is the identity on macOS/Linux (which render & literally), and apply it to the About submenu label.
17 lines
635 B
Go
17 lines
635 B
Go
//go:build windows
|
|
|
|
package main
|
|
|
|
import "strings"
|
|
|
|
// menuLabel escapes a tray-menu label for Win32. A single ampersand in an
|
|
// MFT_STRING menu item is consumed as the mnemonic (accelerator) prefix and
|
|
// never painted — so "Help & Support" renders as "Help Support". Doubling it
|
|
// to "&&" tells Win32 to draw a literal ampersand. Wails v3 passes the label
|
|
// straight to InsertMenuItem without escaping (see menuitem_windows.go), so we
|
|
// do it here. macOS/Linux render "&" literally and use the identity helper in
|
|
// the sibling tray_label_other.go.
|
|
func menuLabel(s string) string {
|
|
return strings.ReplaceAll(s, "&", "&&")
|
|
}
|