From 2cae150197b6a987b11db34907ccc63e07dca56e Mon Sep 17 00:00:00 2001 From: banozz <263121691+banozz0@users.noreply.github.com> Date: Thu, 27 Aug 2026 16:28:02 +0200 Subject: [PATCH] fix(desktop): let every CEF first responder own the paste hotkey MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The renderer-edit passthrough introduced with the chat/Docs/Source guard stops the Cmd+V terminal binding from shadow-pasting into the shell-focus terminal while a Chromium surface is AppKit's first responder. The same double-fire exists for every other CEF surface — app modals, the sidebar, Kanban/Automate pages, titlebar popups, browser tabs, the editor companion — because shell_focus keeps naming a terminal pane while those views hold native focus. The phantom terminal draft it leaves behind is what a later chat send's draft-preservation step sweeps into Saved Prompts as a prompt the user never saved. Widen the guard to any CEF first responder: a Chromium view always owns its own paste. Co-Authored-By: Claude Fable 5 --- apps/desktop/src/app/focus.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/app/focus.rs b/apps/desktop/src/app/focus.rs index 5e8d168a..8d7ba114 100644 --- a/apps/desktop/src/app/focus.rs +++ b/apps/desktop/src/app/focus.rs @@ -402,12 +402,21 @@ impl GhostexGpuiApp { &self, cx: &mut gpui::Context, ) -> bool { + /* + CDXC:GPUICefFirstResponderPastePassthrough 2026-08-27: + Every CEF surface qualifies, not just the editable Source/Manage/Chat + renderers: `shell_focus` keeps naming a terminal pane while a modal, + the sidebar, a Kanban page, a titlebar popup, or a browser tab holds + AppKit's first responder, so without this gate the Cmd+V binding + shadow-pastes the same clipboard into that pane's hidden terminal + composer. That phantom draft is what a later chat send's + draft-preservation step sweeps into Saved Prompts. A Chromium first + responder always owns its own paste. + */ #[cfg(target_os = "macos")] let renderer_edit_cef_owns_native_focus = matches!( self.first_responder_target, - FirstResponderTarget::CefSurface(FirstResponderCefSurface::ProjectWorkarea( - ProjectWorkareaCefSurfaceSlotKey::Source | ProjectWorkareaCefSurfaceSlotKey::Manage - )) | FirstResponderTarget::CefSurface(FirstResponderCefSurface::SessionChat(_)) + FirstResponderTarget::CefSurface(_) ); #[cfg(not(target_os = "macos"))] let renderer_edit_cef_owns_native_focus = false;