Before submitting
Area
apps/desktop
Steps to reproduce
- Open a conversation containing a fenced code block with two or more lines:
cd ~/dotfiles
sudo dnf remove niri xwayland-satellite alacritty
- Triple-click the final line to select it.
- Press Ctrl+C.
- Paste into a terminal or plain-text editor.
The same problem occurs when triple-clicking the only line in a single-line code block (as it's also the last line).
For comparison, triple-clicking a non-final line copies plain text correctly.
Expected behavior
Only the selected command is copied:
sudo dnf remove niri xwayland-satellite alacritty
Actual behavior
The selected command is wrapped in a Markdown fence and language identifier, thus clipboard stores this:
```bash
sudo dnf remove niri xwayland-satellite alacritty
```
Impact
Minor bug or occasional failure
Version or commit
0.0.34-nightly.20260823.1170
Environment
Fedora, Sway WM, Desktop app via AppImage (it happens in web too tho)
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Drag-select the command without including the final line boundary, or use the code block's Copy button.
Related issue
This appears to be a remaining edge case of #4741, which was closed by #5069. The fix works for ordinary partial selections, but triple-clicking the final line still reproduces the original fenced-copy behavior on a nightly containing that fix.
Investigation
chatMarkdownClipboardPayload copies plain text when the selection's common ancestor is inside <pre>.
Triple-clicking the final line appears to include the code block's trailing boundary. A minimized DOM Range with that shape has the outer Markdown container as its common ancestor. cloneContents() then produces a partial wrapper containing <pre>, which the Markdown serializer converts back into a fenced block.
This also explains the observed difference:
- Triple-clicking a middle line keeps the range inside
<pre> and copies plain text.
- Triple-clicking the final or only line crosses the trailing boundary and copies fenced Markdown.
Before submitting
Area
apps/desktop
Steps to reproduce
The same problem occurs when triple-clicking the only line in a single-line code block (as it's also the last line).
For comparison, triple-clicking a non-final line copies plain text correctly.
Expected behavior
Only the selected command is copied:
Actual behavior
The selected command is wrapped in a Markdown fence and language identifier, thus clipboard stores this:
Impact
Minor bug or occasional failure
Version or commit
0.0.34-nightly.20260823.1170
Environment
Fedora, Sway WM, Desktop app via AppImage (it happens in web too tho)
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Drag-select the command without including the final line boundary, or use the code block's Copy button.
Related issue
This appears to be a remaining edge case of #4741, which was closed by #5069. The fix works for ordinary partial selections, but triple-clicking the final line still reproduces the original fenced-copy behavior on a nightly containing that fix.
Investigation
chatMarkdownClipboardPayloadcopies plain text when the selection's common ancestor is inside<pre>.Triple-clicking the final line appears to include the code block's trailing boundary. A minimized DOM Range with that shape has the outer Markdown container as its common ancestor.
cloneContents()then produces a partial wrapper containing<pre>, which the Markdown serializer converts back into a fenced block.This also explains the observed difference:
<pre>and copies plain text.