Skip to content

Paste into Sublime Text, Sublime Merge and Zed - #240

Merged
alexkroman merged 1 commit into
mainfrom
fix/paste-into-custom-drawn-editors
Oct 9, 2026
Merged

alexkroman merged 1 commit into
mainfrom
fix/paste-into-custom-drawn-editors

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Problem

Dictating into Sublime Text never pasted: the transcript always landed on the clipboard with the "Copied" notice. Sublime Merge and Zed behave the same way.

These editors draw their own text views and expose no text element to Accessibility. With the caret in a buffer, the focused element is the bare AXWindow (no value, no selection range), or the system-wide AXFocusedUIElement query fails with kAXErrorCannotComplete (-25204). They aren't browsers and don't bundle Electron, so isAXOpaqueApp was false. KeyInjector.insert therefore threw .noEditableTarget and fell back to copy-only.

Fix

This adds a third kind of app to FocusCapture.isAXOpaqueApp: custom-drawn editors, matched by bundle-ID prefix the same way the browser list is.

  • com.sublimetext. covers Sublime Text 3 and 4
  • com.sublimemerge
  • dev.zed.Zed covers Zed, Preview and Nightly

The paste path itself is unchanged; this only widens the "paste even with no AX signal" exemption. The trade-off is the one browsers and Electron already accept: a rare ⌘V beep if nothing editable is focused.

Verification

  • Probed each app's AX tree with the caret in a text box. Sublime Text 4 (4215), Sublime Merge (2132, commit-message box) and Zed 1.23.2 all expose only the window.
  • Wrote the pasteboard and posted a synthesized ⌘V the way the injector does. The text landed in all three apps.
  • New CustomDrawnEditorBundleIDTests cover the matches, near-misses and nil. The wrappers are also pinned in the existing pass-through tests.
  • swift test (bundle-ID, AX-opaque and KeyInjector suites), swiftlint --strict, swift-format lint --strict, check-invariants.sh and Prettier all pass.
  • Not run: the full scripts/check.sh (CI covers it) or a real spoken dictation in Blurt Dev.

🤖 Generated with Claude Code

These editors draw their own text views and expose no text element to
Accessibility: with the caret in a buffer the focused element is the bare
AXWindow (or the system-wide query fails with kAXErrorCannotComplete). They
are neither browsers nor Electron, so the editability gate read them as
"nothing editable focused" and every dictation fell back to copy-only.

Add a custom-drawn-editor arm to isAXOpaqueApp, matched by bundle-ID prefix
like the browser list. Measured on Sublime Text 4 (4215), Sublime Merge
(2132) and Zed 1.23.2; a synthesized Cmd-V lands in all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman enabled auto-merge (squash) October 9, 2026 17:57
@alexkroman
alexkroman merged commit 3fd91b1 into main Oct 9, 2026
13 checks passed
@alexkroman
alexkroman deleted the fix/paste-into-custom-drawn-editors branch October 9, 2026 18:06
@alexkroman alexkroman mentioned this pull request Oct 9, 2026
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.

2 participants