GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(app): support key chords in shortcuts by Brendonovich · Pull Request #64395 · anomalyco/opencode Conversation
|
| Before | After |
|---|---|
![]() |
![]() |
After clicking + and pressing ⌥S, and the next-key panel after pressing ⌥G in the prompt:
| Chord saved | Next-key panel |
|---|---|
![]() |
![]() |
Captured at 1280×800 with the e2e mock server, on Settings > Shortcuts, with no stored settings.
None. No default shortcut is a chord, so nothing changes until a user records one.
@opentui/keymap engine.bun typecheck and lint pass in packages/app.bun run test:unit (2739) and bun run test:browser (361) pass.keymap.test.ts: chords from text fields and elsewhere, and Escape and Backspace on a pending chord.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The chord engine works in the happy-dom tests, but I couldn't see Settings > Shortcuts or the next-key panel in a real browser. I relied on your screenshots for those.
What I ran in packages/app:
src/shell/commands and src/settings/keybinds: 84 passtest:browser: 358 passtsc -b: cleancreateAppKeymap / registerCommandLayers, which show the two problems belowPublic API: unchanged. The new @opentui/keymap dependency and the prompt.stop command stay inside the app. commandKeymap and resolveKeybindOption are no longer exported from command.tsx, but nothing outside the app uses them.
Two problems worth fixing, details inline:
editable commands, which now includes the palette, still take typing in text fields.Note that the base is dev, so this diff also contains the keymap engine commit.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ), | ||
| ) | ||
|
|
||
| createEffect(() => { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This effect throws away every keymap layer and registers new ones whenever options() recomputes. The engine then forgets any pending chord, because it only keeps captures whose layer is still registered. I checked it: press ctrl+k for a ctrl+k ctrl+c binding, re-register, press ctrl+c, and the pending sequence is gone and nothing runs. options() recomputes on ordinary state changes, e.g. prompt.stop's disabled flips when a session starts or stops. So a chord can be cancelled halfway through for no visible reason, and every recompute rebuilds all layers. Could registration only happen when the bindings actually change? Or could disabled and the other reactive state be handled through the engine's conditions or a check at run time, instead of re-registering everything?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .map((combo) => { | ||
| const key = keymapKey(combo) | ||
|
|
||
| return { key, cmd: option.id, outsideText: !option.editable && typesCharacter(keymap, key) } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
When a command is editable, the outsideText guard is skipped, and command.tsx now makes the palette editable unconditionally. So if the palette (or any of the other editable commands) is recorded as a plain-letter chord like g p, pressing g in the composer is swallowed and starts a pending chord. I checked it: default prevented, sequence pending. The description says a chord whose first key types a character only starts outside text fields. editable makes sense for modified single strokes, but should a sequence whose first key types a character stay out of text fields even for editable commands?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.