6

There's a new-to-me Copy button on fenced code blocks on various stack exchange sites now. When pressed, it puts a copy of the code block to the client's clipboard, along with a couple lines of attribution.

The attribution lines use Windows line endings. The body of the fenced code uses Unix line endings (or possibly, the client's native line endings).

The expected behavior is consistent line endings in the copied text in the client's native line ending format.

Example:

// Source - https://stackoverflow.com/q

is actually:

00000000 2f 2f 20 53 6f 75 72 63 65 20 2d 20 68 74 74 70 |// Source - http|
00000010 73 3a 2f 2f 73 74 61 63 6b 6f 76 65 72 66 6c 6f |s://stackoverflo|
00000020 77 2e 63 6f 6d 2f 71 0d 0a |w.com/q..|
---- CRLF ---------------------^

For me, this results in <CR> markers in my text editor if I paste in a code block.

I can reproduce this on superuser.com and stackoverflow.com on macOS 14.7.6 with Safari 18.6, and Mint linux 21.3 with Chromium 120 and Firefox 144.

I would speculate that the template file used to render the attribution was saved with Windows line endings.

V2Blast StaffMod
9,0954 gold badges42 silver badges87 bronze badges
asked Nov 15 at 3:22
6

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.