Repository navigation
feat(editor): register Space/Escape with the host shortcut service (#39, #40) - #66
Conversation
…, #40) Move the editor's Space (transport) and Escape (dismissal ladder) handling onto window.registerShortcut({ scope: 'plugin-editor' }) so the global ? panel lists them, and reduce onKeyDown to the gates that cannot be registry rows plus an inert fallback for hosts without the API. One key press, one action: the fallback stands down when editorShortcutState.registered is true.
|
Diagnosis: The failing check suite ( Fix: Split
The ladder order, gates (parts-view, recording, tap-tempo, typing), and fall-through semantics are unchanged; the inline typing guard now uses the existing Verification: Task list (7/7 completed)
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by free · Input: 655.3K · Output: 8.9K · Cached: 583.2K |

What & why
Completes the keybind migration from #10. This lands #39 (migrate Space and Escape) as the prerequisite for #40 (remove the document-level listener), because #40 could not be done without it.
Play / pause) and Escape (Close the top layer, or clear the selection) now register throughwindow.registerShortcut({ key, handler, description, scope: 'plugin-editor' }), alongside the editing keys from Keybinds 2/4: migrate the editing keys (Delete, Backspace, G, F, K) to registerShortcut #38, so the global?help panel lists them.onKeyDownis reduced to the gates that genuinely cannot be registry rows, plus an inert compatibility fallback for the migrated keys:editorShortcutState.registeredis true, so a key is never handled twice.Collision resolution (from #39 / the #37 audit)
Space/EscapearePlayer-scoped, so they do not fire on the#plugin-editorscreen; the editor's own registrations areplugin-editorso they only fire there. This is the reason the editor keeps its own Space rather than delegating to the host's.preventDefault()s only when it actually consumed the key, leaving an unowned Escape to the Host's back-to-library.e.key === ' ') and the Host'se.code === 'Space'token form.Testing
node --test— 400 pass, 0 fail (new suite: Space/Escape registration, the full Escape ladder including ghost-before-barline precedence, the parts-view/prompt guards, and an explicit no-double-handling test assertingonKeyDownstands down once the registry is active).npx eslint@9.39.4 src tests— 0 errors (3 pre-existing warnings unchanged).Not verified here
?panel renders every shortcut: no desktop/browser host is available in this environment. The registrations carry descriptions andplugin-editorscope, which is what the panel reads._recStateis a module-private live binding with no test setter, and drivingeditorStartRecordMidi()needs a real MIDI device + audio._editorTogglePlayShortcutdeliberately omits the recording gate (Space finalizes a take), so the behavior is structural.Closes #39
Closes #40
Part of #10
big-pickle(free) | 𝕏