Sometimes you want to write something with broken lines and you write in the editor:
That’s right I’m Sokka
It’s pronounced with an Okka
Young Ladies, I rocked ya!
But it ends up looking like this:
That’s right I’m Sokka It’s pronounced with an Okka Young Ladies, I rocked ya!
The fix is to add two spaces between the final character and the carriage return.
I don’t understand what the problem is. CR should be easy enough to translate, and the users intentions are clearly confirmed because they’re looking right at what the expect it to look like when they hit submit.
Why does the user have to add two spaces? Why is the universe like this?
Edit: Holy Shit, look, I’m just an idiot typing text expecting WYSIWYG and I don’t see a good reason for why I’m not getting it other than that programmers lack theory of mind.


Is this a rant about typewriters, computer character encodings, or some computer file format?
Why are you getting files with bare CR characters not followed by a LF? (Is this about last millennium Apple computers?)
I think they’re talking largely (mostly?) about Markdown. (For instance, in Lemmy, when you stick a newline there, it doesn’t give you a line break in the flow of the text.) And when they say “Carriage Return”, they don’t know what they’re talking about. If I’m interpreting them correctly, I think they just mean “newline”. And when they say “two spaces”, I think they mean two newlines.
Yes, I may not be using the right terminology. The “return” button on the keyboard.
I also gave an example, so I’m not sure why there’s so much confusion.
Because you’re not using the right terminology. ;)
Yeah, but if someone said, “I sharpened a steel bowl and used it to cut my steak, and here’s a picture of my bowl” and you see a knife, wouldn’t you know what they mean?
Maybe it is I that lacks theory of mind.
You ok?
Because it’s Markdown it gets confusing. Here is some help. Line Breaks
This is a question about a behavior that the text editor of both Reddit and Lemmy seem to share.
I might be incorrect calling it a carriage return–it’s the return button on the keyboard that creates a new line on the editor–I think it’s called a line break, but apparently you need two to create an actual new line in the final text. See the other comment for details about how markdown approaches it.
There is Carriage Return (CR), and also Line Feed (LF, often called New Line). If you think about old mechanical printers with the metal arm sticking out, a CR operation would move the type head to the far left column, and a LF operation would advance the paper by one line. Variously through the years depending on hardware (typewriter, teletype, those early CRTs that you had to refresh the screen, or modern computers) you would get one or both of those if you pressed Return/Enter, and it’s configurable in software, depending on the software. I don’t know what windows does these days with notepad, but at one time the Enter key sent both (CRLF). UNIX style systems tended to use LF, and older Macs as someone else referenced used CR. If you wrote a generic program to handle anything you had to account for all of them. Mostly these days it gets abstracted away which generally works well enough unless a team of people used a random collection of software to edit a text file.
printf "\r\nHexadecimal, like that scene from The Martian.\n" | hexdump -C 00000000 0d 0a 48 65 78 61 64 65 63 69 6d 61 6c 2c 20 6c |..Hexadecimal, l| 00000010 69 6b 65 20 74 68 61 74 20 73 63 65 6e 65 20 66 |ike that scene f| 00000020 72 6f 6d 20 54 68 65 20 4d 61 72 74 69 61 6e 2e |rom The Martian.| 00000030 0a |.| 00000031The 0a is a Line Feed character, and the 0d is a Carriage Return character. In my terminal without piping it through hexdump you get:
printf "\r\nHexadecimal, like that scene from The Martian.\n" Hexadecimal, like that scene from The Martian.The LF at the end of the string makes it so that the prompt at the terminal doesn’t appear on the same line as the output, and the blank line before the text is caused by the LF at the beginning. I don’t know/care/have to worry about what eats the CR.
Ah! Thank you for explaining it in terms of typewriters, now it’s much clearer in my mind!
The confusion still lingers. I used to cut and paste websites to print. One part of the condensation process, in addition to removing ads, was removing all the two-space line breaks of CRCR or LFLF; I still have to search for both.
You could probably get 80% of that process done by learning some python. If you have a string “s”, then replacing double newlines with a single newline is as easy as
re.sub("\n\n", "\n", s)where “\n” is an LF in many programming languages. A CR is often “\r” in the same vein. Just be aware that regular expressions can be very, very frustrating; and every webpage is going to be a new adventure in how it got formatted. If you use something like spyder it’ll allow you to see what the data looks like inside the python process so you get a chance to iterate.
So, it is about markdown.
It’s this way because people want to break their editable text into lines without making the final text break paragraphs. People write entire books in markdown, but it does become unsettling when you use in social media comments.