镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Modifier names from browsers, Silk.NET, ImGui and GLFW aren't canonicalized: ControlLeft+C never equals Ctrl+C and displays as C+CONTROLLEFT #205

Closed

Description

@matt-edmondson

What's wrong

Note.CanonicalizeKey (Keybinding/Models/MusicalTypes.cs:74-83) folds the WinForms, WPF and ConsoleKey modifier spellings into CTRL, ALT, SHIFT and META. Several other common spellings are not folded:

  • Browser KeyboardEvent.code: ControlLeft/ControlRight, ShiftLeft, AltLeft, MetaLeft, OSLeft
  • Silk.NET Key: ControlLeft, ShiftLeft, AltLeft, SuperLeft
  • ImGuiKey: LeftSuper (LeftCtrl is already handled)
  • GLFW: LEFT_CONTROL, LEFT_SHIFT, LEFT_ALT, LEFT_SUPER
  • macOS-style LeftCommand

Each of these is treated as an ordinary key. As a result:

  • the chord never equals the canonical one;
  • IsModifierNote is false;
  • the modifier sorts after the main key when the chord is displayed.

This matters for the org's own stack. ImGuiApp is built on Silk.NET and ImGui, so a binding captured from a Silk.NET key event cannot match one written as Ctrl+C. #166 and #198 widened the alias table, but they did not cover these spellings.

Reproduction (HEAD b035bdb)

foreach (string s in new[] { "ControlLeft+C","ControlRight+C","LeftSuper+C","SuperLeft+C","MetaLeft+C","ShiftLeft+C","AltLeft+C","OSLeft+C","LEFT_CONTROL+C","LeftCommand+C" })
{
    Chord c = Chord.Parse(s);
    bool eq = c == Chord.Parse("Ctrl+C") || c == Chord.Parse("Meta+C") || c == Chord.Parse("Shift+C") || c == Chord.Parse("Alt+C");
    Console.WriteLine($"{s} -> '{c}' equals canonical: {eq}");
}
ControlLeft+C  -> 'C+CONTROLLEFT'  equals canonical: False
ControlRight+C -> 'C+CONTROLRIGHT' equals canonical: False
LeftSuper+C    -> 'C+LEFTSUPER'    equals canonical: False
SuperLeft+C    -> 'C+SUPERLEFT'    equals canonical: False
MetaLeft+C     -> 'C+METALEFT'     equals canonical: False
ShiftLeft+C    -> 'C+SHIFTLEFT'    equals canonical: False
AltLeft+C      -> 'ALTLEFT+C'      equals canonical: False
OSLeft+C       -> 'C+OSLEFT'       equals canonical: False
LEFT_CONTROL+C -> 'C+LEFT_CONTROL' equals canonical: False
LeftCommand+C  -> 'C+LEFTCOMMAND'  equals canonical: False

Expected: each spelling equals the canonical chord and displays as Ctrl+C, Meta+C, Shift+C or Alt+C.

Suggested fix / acceptance criteria

  • Extend the switch with these names:
    • CONTROLLEFT/CONTROLRIGHT
    • ALTLEFT/ALTRIGHT
    • SHIFTLEFT/SHIFTRIGHT
    • METALEFT/METARIGHT
    • SUPERLEFT/SUPERRIGHT
    • LEFTSUPER/RIGHTSUPER
    • OSLEFT/OSRIGHT
    • LEFTCOMMAND/RIGHTCOMMAND
    • the GLFW forms LEFT_CONTROL, LEFT_SHIFT, LEFT_ALT, LEFT_SUPER and their RIGHT_* counterparts
  • Add a row to KeyAliasEquivalenceTests for each spelling.

Activity

  1. matt-edmondson commented on Oct 31, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions