Commit c3fffb5
committed
fix(v3): name only presses that can actually be bound, on macOS
Addresses both review comments on #6032, each confirmed with a test that
fails against the previous code first.
A press with no name was still named after its modifiers alone, producing
strings like "cmd" that no binding can match and that parseAccelerator
rejects outright - so each one was reported as an error rather than
ignored. The name is now empty in that case, and -keyDown: does not send an
empty name on, which would only have moved the error rather than removed
it. -performKeyEquivalent: already declined to.
F21 to F35 and the keypad's Clear key had no name at all. namedKeys accepts
f21 through f35 and numlock, so bindings can be written for them, but
nothing on macOS ever produced those names: the keys exist only on extended
keyboards, where AppKit reports them through characters rather than through
a key code this build knows. They are named from their characters now -
NSF21FunctionKey and consecutive, and NSClearLineFunctionKey for numlock.
Neither was introduced by this pull request; both were carried over from
the Objective-C the branch replaced.
Also verified against a running application: bindings still fire, and no
accelerator now fails to parse.
Claude-Session: https://claude.ai/code/session_01WP7MWnMpQDT2WB7CPLWbqr1 parent f62a500 commit c3fffb5
3 files changed
Lines changed: 94 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| |||
83 | 107 | | |
84 | 108 | | |
85 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
86 | 118 | | |
87 | 119 | | |
88 | 120 | | |
| |||
96 | 128 | | |
97 | 129 | | |
98 | 130 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 131 | + | |
102 | 132 | | |
103 | 133 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
84 | | - | |
85 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
86 | 91 | | |
87 | | - | |
88 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
89 | 137 | | |
90 | | - | |
91 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
92 | 141 | | |
93 | 142 | | |
94 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
0 commit comments