From 098122be8dc98a1c18633dc4315f5d429519c08e Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Thu, 6 Aug 2026 10:52:40 +0200 Subject: [PATCH] Keep copied assistant selections within their visible boundaries (#2930) * fix(app): respect assistant copy selection boundaries Selection serialization reintroduced semantic ancestors even when the user selected only their inner text, causing list markers and code delimiters to expand beyond the visible range. Preserve semantics only for complete selected nodes, and keep rich list payloads compatible with text composers that prefer HTML. * fix(app): preserve loose list copy breaks --- .../browser/assistant-selection-copy.spec.ts | 42 ++- .../content.browser.test.ts | 241 ++++++++++++++++++ .../assistant-selection-copy/content.web.ts | 228 ++++++++++++++--- 3 files changed, 463 insertions(+), 48 deletions(-) create mode 100644 packages/app/src/assistant-selection-copy/content.browser.test.ts diff --git a/packages/app/e2e/browser/assistant-selection-copy.spec.ts b/packages/app/e2e/browser/assistant-selection-copy.spec.ts index 2df4420ec..4dcbfd47b 100644 --- a/packages/app/e2e/browser/assistant-selection-copy.spec.ts +++ b/packages/app/e2e/browser/assistant-selection-copy.spec.ts @@ -199,12 +199,14 @@ test("copying an assistant selection preserves Markdown structure and links", as const clipboard = await readRichClipboard(page); expect(clipboard.plainText).toBe(EXPECTED_WHOLE_SELECTION_MARKDOWN); - expect(clipboard.html).toContain("