From 4ed13fadb63a2d729f1f99eb5512253bcedeb585 Mon Sep 17 00:00:00 2001
From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com>
Date: Mon, 5 Oct 2026 21:52:51 +0200
Subject: [PATCH] fix(app): keep list numbers when a copy crosses a code block
nested in an item (#6158)
A selection starting after an item's marker demotes that item to a paragraph.
When the item holds a code block, Turndown's HTML re-parse splits the paragraph
into several siblings, and counting siblings numbered the next item too high
("4. Done." instead of "2. Done."). Each item now carries its number before
the re-parse.
Closes #6140
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
---
.../content.browser.test.ts | 26 +++++++++++++++++++
.../assistant-selection-copy/content.web.ts | 19 +++++++++++---
2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/packages/app/src/assistant-selection-copy/content.browser.test.ts b/packages/app/src/assistant-selection-copy/content.browser.test.ts
index 00a64406ea..995927f106 100644
--- a/packages/app/src/assistant-selection-copy/content.browser.test.ts
+++ b/packages/app/src/assistant-selection-copy/content.browser.test.ts
@@ -320,6 +320,32 @@ describe("assistant selection copy ranges", () => {
).toBe("6. Second bullet text");
});
+ it("keeps the next number when a drag crosses a code block nested in an item", () => {
+ const message = mountFixture();
+ const list = fixtureElement(message, '[data-paseo-markdown-tag="ul"]');
+ list.outerHTML = [
+ '