From 41488bda8adcc2a67c9b7b9df767ec80000a0a34 Mon Sep 17 00:00:00 2001 From: Thomas Obermueller Date: Tue, 19 May 2026 08:27:13 +0000 Subject: [PATCH 1/2] fix: keep inline tool call open while selecting text Drag-selecting text inside an expanded ToolCallView or ExecuteToolView released on the outer Box, which fired the toggle's onClick and collapsed the card before the selection could be copied. Guard the handler with window.getSelection(), matching the existing pattern in SessionView. Generated-By: PostHog Code Task-Id: ee883416-a83f-4b1d-b097-6164d01f04fe --- .../sessions/components/session-update/ExecuteToolView.tsx | 7 ++++--- .../sessions/components/session-update/ToolCallView.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx b/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx index a0a80930a..8d4ae0f4c 100644 --- a/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx +++ b/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx @@ -45,9 +45,10 @@ export function ExecuteToolView({ const isExpandable = hasOutput; const handleClick = () => { - if (isExpandable) { - setIsExpanded(!isExpanded); - } + if (!isExpandable) return; + const selection = window.getSelection(); + if (selection && selection.toString().length > 0) return; + setIsExpanded(!isExpanded); }; return ( diff --git a/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx b/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx index 86f30c411..c81b0e8d6 100644 --- a/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx +++ b/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx @@ -88,9 +88,10 @@ export function ToolCallView({ const isExpandable = !!fullInput || hasOutput; const handleClick = () => { - if (isExpandable) { - setIsExpanded(!isExpanded); - } + if (!isExpandable) return; + const selection = window.getSelection(); + if (selection && selection.toString().length > 0) return; + setIsExpanded(!isExpanded); }; return ( From 1782c6100be4d4910a3ea451f5c69c25b4ace696 Mon Sep 17 00:00:00 2001 From: Adam Bowker Date: Tue, 19 May 2026 08:51:24 -0700 Subject: [PATCH 2/2] refactor: scope tool card toggle to header instead of guarding selection Move onClick onto the header Flex so the expanded content is a sibling, matching ReadToolView/FetchToolView/SearchToolView. Drops the window.getSelection() guard and makes the text cursor behave correctly over selectable output. Generated-By: PostHog Code Task-Id: 5e50fa6d-be32-4c59-8f3f-32682196f1d7 --- .../session-update/ExecuteToolView.tsx | 18 +++++++++--------- .../components/session-update/ToolCallView.tsx | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx b/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx index 8d4ae0f4c..c48d024e8 100644 --- a/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx +++ b/apps/code/src/renderer/features/sessions/components/session-update/ExecuteToolView.tsx @@ -45,18 +45,18 @@ export function ExecuteToolView({ const isExpandable = hasOutput; const handleClick = () => { - if (!isExpandable) return; - const selection = window.getSelection(); - if (selection && selection.toString().length > 0) return; - setIsExpanded(!isExpanded); + if (isExpandable) { + setIsExpanded(!isExpanded); + } }; return ( - - + + { - if (!isExpandable) return; - const selection = window.getSelection(); - if (selection && selection.toString().length > 0) return; - setIsExpanded(!isExpanded); + if (isExpandable) { + setIsExpanded(!isExpanded); + } }; return ( - - + +