Ai prompt fix#396
Conversation
The prompt window's 'window-shown' IPC message was sent immediately after
createPromptWindow() — but on the first open the BrowserWindow had just
been created and the React app hadn't mounted yet, so PromptApp's
onWindowShown listener wasn't registered. The message was silently
dropped. Subsequent opens reused the already-loaded window, so the
listener was live and the text arrived correctly.
Fix mirrors the pattern used for the main launcher window:
- PromptApp now calls rendererReady() on mount, emitting the same
'renderer-ready' IPC signal the main App.tsx sends.
- createPromptWindow registers an ipcMain.once('renderer-ready') handler
(with re-register-on-wrong-sender semantics) that sets
promptRendererReady=true and flushes any pending payload.
- showPromptWindow checks promptRendererReady: if true, sends
immediately (all subsequent opens); if false, stores the payload in
pendingPromptWindowShown so the handler delivers it once the app mounts.
Also rewrites get-selected-text.swift with BFS traversal across focused
element, focused window, and system-wide element roots; adds text marker
range support for Chromium/Electron apps; skips secure text fields; and
adds AXEnhancedUserInterface opt-in for richer attribute access. Adds
AppKit framework to the native build command to support NSWorkspace.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- clipboard-manager.ts: update getFastPasteAddon → getNativeHelpersAddon / fast_paste.node → native_helpers.node (addon rename from #392). Adopt main's expanded image-format support (jpeg/webp/heic/tiff via readClipboardBufferForFormats, nativeImage fallback). Keep our changeCount optimisation and add fallbackImage to destructuring. - native_helpers.mm: export both getPasteboardChangeCount (this branch) and setWindowAnimationBehaviorNone (from #392). - package.json build:native: keep -framework AppKit for get-selected-text (required by the selected-text fix on this branch) while using native-helpers-addon / native_helpers.node paths from main's rename. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a351c68720
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| enqueueFocusedChild(of: element, depth: depth, into: &queue) | ||
| enqueueChildren(of: element, depth: depth, into: &queue) |
There was a problem hiding this comment.
Restrict selection lookup to focused AX subtree
findSelectedText now breadth-first scans every AXChildren node and returns the first non-empty selection it finds, even if that element is not focused. In multi-pane apps (editors, split views, sidebars), an unfocused control can keep stale selected text while the active control exposes selection only via marker APIs, so this search can return unrelated text and cause cursor-prompt rewrites to target the wrong content. The lookup should constrain accepted matches to the focused chain (or otherwise validate focus ownership) before returning.
Useful? React with 👍 / 👎.
No description provided.