Repository navigation
Conversation
|
Build artifacts for PR #4873: Run: https://github.com/marktext/marktext/actions/runs/28748398662
|
Recording ⌘⇧7 in Preferences → Key Bindings saved `Cmd+7`, and even the correctly-spelled `Cmd+Shift+7` never fired at runtime. Both symptoms share one root cause in `@hfelix/electron-localshortcut`'s atom-keymap port: `normalizeKeyboardEvent` keeps Shift as a modifier only for non-character keys and upper-case Latin letters. For digits/punctuation the recorder is meant to store the shifted character instead, but when a primary modifier is held macOS reports the base character (⌘⇧7 -> key "7"), so Shift is dropped from BOTH the recorded accelerator and the runtime `before-input` match — the binding becomes unreachable. Because the recorder and the shortcut matcher run the same normalize function, fixing it there repairs both at once. Patch the library (via patch-package, like the existing native-keymap patch) to also keep Shift whenever ctrl/meta is held. Without a primary modifier the shifted-character behaviour is unchanged (Shift+7 -> "&"). Guarded by test/unit/specs/keybinding-shift-modifier.spec.ts, which drives the patched library through its public recorder API on the platform-independent Ctrl path. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Jocs
force-pushed
the
fix/keybinding-recorder-shift-4863
branch
from
July 5, 2026 16:39
4759eb0 to
fd53796
Compare
The setup action installs with `--ignore-scripts`, so patch-package never runs in the unit-test job and specs execute against unpatched dependencies. Apply the patches first so the tests exercise the same patched libraries the app ships — notably the @hfelix/electron-localshortcut keybinding fix (#4863), whose regression test needs the patch to be present. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
niyo-oyin
added a commit
to niyo-oyin/marktext-ja
that referenced
this pull request
Jul 30, 2026
Upstream PRs applied (all diff-reviewed, tests included and passing): - marktext#4776: preserve ordered-list source markers — opening and saving no longer rewrites 1./1./1. to 1./2./3. (marktext#4772, silent doc mutation) - marktext#4788: UNC/WSL paths become valid file:// authority URLs (file://server/share/…, not file:////…) so network images load (marktext#4577, marktext#4563) - marktext#4952: table columns size to content (min-width 10em → 2em, marktext#4894) - marktext#4773: malformed percent-escape in a clicked link no longer throws an unhandled URIError (marktext#4749) - marktext#4873: Shift+digit/punctuation keybindings recordable and matchable again (patch-package fix for @hfelix/electron-localshortcut, marktext#4863) - marktext#4910: sidebar icons match by extension first, so Dockerfile-Notes.md gets the markdown icon (marktext#4890) - marktext#4317: restored windows are clamped to the target display's work area (multi-monitor / DPI, marktext#2928, marktext#1947) Found while integrating marktext#4776: cloneStateTree shallow-copied meta, so array-valued fields (order-list sourceMarkers, table aligns) stayed SHARED between a getState() clone and the live document — mutating a returned tree corrupted the document. Meta arrays are now copied, and the clone walks an explicit work list instead of recursing, so pathological nesting (600-level lists, marktext#4747) can no longer overflow the call stack (10k-depth regression test). Also: folder search debounces its per-keystroke ripgrep run (300ms, Enter searches immediately, IME-composing keys ignored) (marktext#3556), and a new undoFloor spec pins that undoing past the opened baseline never empties the document (marktext#5028 — legacy-engine bug, does not reproduce on @muyajs/core). muya 1536/1536, desktop 783/783, lint/tsc/madge clean. PLANS.md gains a prioritized backlog from the full 563-item issue/PR survey.
Member
Author
|
Closing this for now — deprioritizing #4863 rather than landing another dependency patch. Alternatives to
The branch |
1 task done
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.
Summary
Fixes #4863. Two symptoms, one root cause:
Cmd+7— Shift silently dropped (the reported bug).Cmd+Shift+7binding never fired — the rebind was dead.Root cause
Both the recorder (
key-input-dialog.vue→getAcceleratorFromKeyboardEvent) and the shortcut matcher (electronLocalshortcut'sbefore-input-eventhandler in the main process) run the samenormalizeKeyboardEventfrom@hfelix/electron-localshortcut's atom-keymap port. It keeps Shift as a modifier only for non-character keys and upper-case Latin letters:For shifted digits/punctuation the port records the shifted character instead (Shift+7 →
&, Atom philosophy). But when a primary modifier is held, macOS reports the base character forKeyboardEvent.key(⌘⇧7 →7), so neither the shifted character nor Shift survives:cmd+7.cmd+7too, which can never equal the stampedshift+cmd+7→ the command never fires.Verified against the real library:
equals(toKeyEvent('shift+cmd+7'), normalize(physical ⌘⇧7)) === false.Fix
Since recorder and matcher share
normalizeKeyboardEvent, fixing it there repairs both consistently. Patch the library (via patch-package, the mechanism already used fornative-keymap) to also keep Shift whenever a primary modifier (Cmd/Ctrl) is held:After the patch (verified against the real library, record + match):
shift+cmd+7ctrl+shift+7shift+cmd+/cmd+7&shift+cmd+BTests
test/unit/specs/keybinding-shift-modifier.spec.tsdrives the patched library through its public recorder API on the platform-independent Ctrl path (Ctrl is honoured on every OS; the meta path is gated on macOS inside the library). Since recorder and matcher share the normalize function, guarding the recorded string guards the match.pnpm run lint,pnpm run typecheck, and the keybinding unit specs pass. The record+match fix is verified end-to-end against the real library (patchednormalizemakesequals(toKeyEvent(accel), normalize(physical press))true); in-app keystroke verification in a dev build is the final manual check.🤖 Generated with Claude Code