Comment on Why does not a CR (Carriage Return) automatically start a new line on some online text editors?

TootSweet@lemmy.world ⁨1⁩ ⁨day⁩ ago

So, I think I kindof know what you’re getting at here, but you’re not being very precise about it.

First some definitions (just for purposes of this conversation – don’t take this to be any assertion that a particular term always inherently has a particular meaning, it’s just a tool for this conversation specifically):

(As an aside a line break is sometimes accomplished with a “line feed” character. A “carriage return” character is something else that isn’t the same thing. Which is a big part of where the confusion comes from.)

What you’re saying, I think, is that putting a single newline in the source doesn’t result in a line break in the rendered output. Is that right?

In some editors (Vim being one I know of), when plain text word wraps, pressing “down” when the cursor is on the first line of a wrapped series of lines causes the cursor to jump not to the second line of wrapped text, but to the first line after the next newline. To illustrate:

If this line is wrapped due to
being wider than the available
width.
And if this line is on its own line
due to being immediately preceeded
by a newline.

If your cursor in the above example was on the “w” in the first line there, pressing down would take the cursor to the space immediately before “is” in “And if this line is on its own line”.

As a result, it can be quite a pain to deal with word wraps in such editors. This is part of why certain code style guides (like this one and this one have hard limits for how many characters are allowed before the next newline.

Given how much more convenient line breaks can be than word wrapping, people writing source to be rendered into rendered output may wish to be able to insert newlines to cause line breaks in the source without causing any change in the corresponding rendered output.

That all make sense?

At least that’s most likely at least one reason why the people who invented Markdown decided specifically to make Markdown work that way.

source
Sort:hotnewtop