Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: skip editor autopair during native IME keydown - #13193

Draft
tiensonqin wants to merge 2 commits into
masterfrom
logseq/fix-ime-autopair-swallow-23ff
Draft

fix: skip editor autopair during native IME keydown#13193
tiensonqin wants to merge 2 commits into
masterfrom
logseq/fix-ime-autopair-swallow-23ff

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #12966

Problem

Editor keydown / keyup listeners are attached with native window.addEventListener, but composing checks used goog-event-is-composing?, which only works on goog-wrapped events. Native IME events (isComposing / keyCode 229 / Process) were treated as non-composing, so [ autopair called preventDefault and inserted [], swallowing Japanese IME (and similar auto-paired keys).

Fix

  • Use native-event-is-composing? in keydown-not-matched-handler and keyup-handler.
  • Give native-event-is-composing? an include-process? arity so keyup can keep isComposing-only filtering while still detecting IME process keys where needed.

Evidence

  • Pre-fix unit test: native [ + keyCode 229 / isComposing incorrectly inserted [].
  • Post-fix unit test: same cases skip autopair; plain [ still autopairs.
  • :app REPL: native-event-is-composing? detects native IME events; goog-event-is-composing? returns nil for the same events.

Tests

  • frontend.handler.editor-test/keydown-not-matched-handler-skips-bracket-autopair-during-ime
  • frontend.util-test/native-event-is-composing?-detects-ime-process-enter
  • Regression: dollar autopair without selection

Manual Japanese IME UI verification was not available here (no Japanese input source).

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 8, 2026 16:06
Window keydown/keyup listeners pass native KeyboardEvents, but the
editor checked composing via goog-event-is-composing?, which only
works on goog-wrapped events. That let Japanese IME `[` → 「 be
swallowed by [] autopair (#12966).

Co-authored-by: Tienson Qin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bracket auto-pair swallows Japanese IME input: typing 「 inserts [] instead

2 participants