fix(app): register every chord that means zoom, not just the canonical one - #131
Draft
gennadiryan wants to merge 1 commit into
Draft
fix(app): register every chord that means zoom, not just the canonical one#131gennadiryan wants to merge 1 commit into
gennadiryan wants to merge 1 commit into
Conversation
…l one Cmd/Ctrl +/- zoom did nothing in the amicode webview. The zoom commands, the CSS-zoom implementation and the platform signal were all present and correct. Only the keybind strings were wrong. Dispatch is an exact (normalized-key, modifier-mask) lookup with no fallback, and only "mod+=" and "mod+-" were registered. Ctrl+Plus on a US layout is physically Ctrl+Shift+"=", which arrives as key "+" (normalized "plus") carrying the shift bit — matching neither the key nor the mask of a bare "mod+=". The numpad's "+" arrives unshifted. On layouts where "=" is itself shifted (DE/FR/Nordic) even the canonical chord carries shift. The bare chord therefore worked only on a US layout via the main-row "=", which is why it survived: it works for whoever happens to try it that one way. Widens zoom-in to "mod+=,mod+shift+=,mod+plus,mod+shift+plus" and zoom-out to "mod+-,mod+shift+_". Reset stays a single chord — "0" is unshifted everywhere we ship, and widening it would start swallowing unrelated chords. Multi-binding is already supported (parseKeybind splits on comma; the keymap builder loops every parsed bind), and tooltips are unaffected since displayKeybind renders only the first. Desktop is untouched: it zooms through the Electron menu accelerator. Adds the first test coverage zoom has ever had, including a seam assertion that layout.tsx registers these exact sets — the mechanism being right while its one integration was wrong is how this shipped, and a test of the chord sets alone would reproduce that. Closes harmoniqs/amicode#266
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Problem
Cmd/Ctrl +/- did not zoom inside the Amicode webview. For anyone on a layout where "=" is a shifted key, zoom was unreachable entirely; for everyone else it worked only via one specific keystroke out of the several that mean "zoom in".
Approach
Register every chord that physically means zoom, rather than only the canonical one. Key reason: nothing was wrong with the zoom implementation — keybind dispatch is an exact key-plus-modifier-mask lookup with no fallback, and the registered chords covered one of four real cases.
Approaches Considered
Scope
Assumptions / Open Qs
What was failing
Keybind dispatch builds a signature from the normalized key and a modifier mask, then does a map lookup with no fallback. Only
mod+=andmod+-were registered.What a user actually presses:
=(US main row)=, no shift=+→ "plus", with shift++→ "plus", no shift=on DE/FR/Nordic —=is shifted=, with shiftThe reported keystroke missed on both the key name and the shift bit. The bare chord worked only on a US layout via the main-row
=— which is why it survived: it works for whoever happens to try it that one way.What changed
mod+=,mod+shift+=,mod+plus,mod+shift+plusmod+-,mod+shift+_Multi-binding needed no new machinery — the parser already splits on comma and the keymap builder already loops every parsed bind. Tooltips are unaffected: the display helper renders only the first chord, so users still see the canonical one.
Verification
packages/appunit suite: 828 passing, 0 failing.Key Decisions
0needs no help.Constraints & Invariants
Source
Closes harmoniqs/amicode#266.
Found during a bug sweep of the amicode ↔ vendored-opencode seam; related seam work is harmoniqs/amicode#243.
Notes
Zoom is only reachable in the web/webview host, and the in-app command palette is the sole non-keyboard route to it. Inside the Amicode webview the palette shortcut is intercepted and forwarded to the editor's own palette, so before this change a user on a shifted-
=layout had no way to zoom at all.Addendum — remote GUI retest (2026-08-07)
A remote GUI retest of this branch showed the zoom chords still unresponsive:
the widened registration did not fix the symptom. This PR is therefore not
ready to merge, and does not close harmoniqs/amicode#266.
What the failure indicates: keybind dispatch itself is exact-lookup with no
fallback, and the registration seam test here proves the widened chord sets
reach the keymap builder — so the remaining doubt is at the event layer
(which key values the host delivers inside the webview, and whether the chords
are intercepted before dispatch). The follow-up should capture the actual key
values and modifier masks the webview receives for those physical chords on
the failing host, rather than widening registration further. The test harness
added here remains the right seam to assert against once the real key values
are known.