@@ -398,11 +398,14 @@ func parseX11Hotkey(display *C.Display, keyString string) (C.uint, C.uint, error
398398// coincidence of spelling, not a contract.
399399//
400400// "Backspace" is the same story with a sharper edge: X11 spells it "BackSpace",
401- // so it resolved through neither path, and the repair that suggests itself —
402- // folding the name through the vocabulary's aliases — grabs the wrong physical
403- // key, for the reason x11CanonicalKeyName below sets out. Delete and Insert are
404- // mapped alongside it rather than left to their matching spellings, so a reader
405- // sees the three editing keys and their distinct keysyms in one place.
401+ // so it resolved through neither path. "Delete" reaches the same keysym on
402+ // purpose: in [hotkeys] the name means the backspace key on every platform —
403+ // kVK_Delete on macOS, VK_BACK on Windows — and X11's own "Delete", the
404+ // forward-delete key, is what a config file would have grabbed here alone.
405+ // The forward-delete key has no hotkey name; one that all three platforms can
406+ // bind is the way to add it, not a Linux-only meaning for this one. Insert is
407+ // mapped alongside the pair rather than left to its matching spelling, so a
408+ // reader sees the editing keys in one place.
406409//
407410// The rest fall through to XStringToKeysym: punctuation, and F1-F24, where
408411// X11's own name for the key is the name Neru writes. Those are pinned by test
@@ -429,10 +432,8 @@ func x11KeysymFor(key string) C.KeySym {
429432 return C .XK_Tab
430433 case keyvocab .KeyEscape :
431434 return C .XK_Escape
432- case keyvocab .KeyBackspace :
435+ case keyvocab .KeyBackspace , keyvocab . KeyDelete :
433436 return C .XK_BackSpace
434- case keyvocab .KeyDelete :
435- return C .XK_Delete
436437 case keyvocab .KeyInsert :
437438 return C .XK_Insert
438439 case keyvocab .KeyUp :
@@ -468,12 +469,13 @@ func x11KeysymFor(key string) C.KeySym {
468469// strings reaching this adapter were already canonicalized — config's
469470// CanonicalHotkeyForPlatform display-cases the base key without folding
470471// aliases — and it is what a grab needs: a grab names a physical key, and the
471- // vocabulary's aliases cross keys that X11 keeps apart. Folding "Backspace" to
472- // "Delete" the way the taps do would resolve XK_Delete and grab the
473- // forward-delete key for a binding written "Backspace". So a named key keeps
474- // its own spelling here — "Enter" does not become "Return", though both are
475- // mapped above — and only "esc", which the vocabulary deliberately keeps out of
476- // the named-key set, resolves through its alias.
472+ // switch above is where each name is given one. Folding "Backspace" to
473+ // "Delete" the way the taps do and then handing "Delete" to XStringToKeysym
474+ // is how a binding written "Backspace" once grabbed the forward-delete key.
475+ // So a named key keeps its own spelling here — "Enter" does not become
476+ // "Return", though both are mapped above — and only "esc", which the
477+ // vocabulary deliberately keeps out of the named-key set, resolves through
478+ // its alias.
477479func x11CanonicalKeyName (key string ) string {
478480 if display , isNamed := keyvocab .NamedKeyDisplay (key ); isNamed {
479481 return display
0 commit comments