

Ask HN: Why do I need a double return when typing a comment? - thisjepisje

When writing a comment, to get to a new line you have to press return twice. I always forget this and end up editing my comment. What is the reason for this behaviour?<p>FF29 on Win7 btw.
======
ColinWright
I speak with no special knowledge, simply being a user of the system. I have,
however, written systems that take user input through web browsers, and have
made decisions like this, so I thought I would suggest a reason.

In HTML, a new line does not imply a new line in the rendered text. Thus there
is a precedent.

When typing text into a browser TEXTAREA, it can be useful to insert new-lines
to aid readability, but those newlines might not correspond to where you would
want new-lines in text when rendered. Instead, you would want the text to
flow, and only get new lines where you have a paragraph break.

So you need to allow the user to put new-lines in the browser textarea without
them creating newlines in the rendered text, and you want some way to allow
the user to specify paragraphs in the rendered text.

The existing system of typing plain text with newlines in the browser for
readability and blank lines for new paragraphs is completely natural to me. In
typing this I've added new lines for readability, and left blank lines for
paragraphs.

It seems a good compromise to me.

Here's what it looks like in my browser TEXTAREA:

    
    
        I speak with no special knowledge, simply being a user of the
        system. I have, however, written systems that take user input
        through web browsers, and have made decisions like this, so I
        thought I would suggest a reason.
    
        In HTML, a new line does not imply a new line in the rendered
        text.  Thus there is a precedent.
    
        When typing text into a browser TEXTAREA, it can be useful to
        insert new-lines to aid readability, but those newlines might
        not correspond to where you would want new-lines in text when
        rendered.  Instead, you would want the text to flow, and only
        get new lines where you have a paragraph break.
    
        So you need to allow the user to put new-lines in the browser
        textarea without them creating newlines in the rendered text,
        and you want some way to allow the user to specify paragraphs
        in the rendered text.
    
        The existing system of typing plain text with newlines in the
        browser for readability and blank lines for new paragraphs is
        completely natural to me. In typing this I've added new lines
        for readability, and left blank lines for paragraphs.
    
        It seems a good compromise to me.
    

_EDIT: I seem to recall that some browsers - probably ancient ones - used to
insert CR into text lines from TEXTAREA fields, possibly after 254 characters
or something. Can anyone confirm that? My Google-fu is failing me, and I could
simply be wrong. Alternatively, it 's so old that no one knows or remembers._

~~~
krapp
When would you ever add a new line in the comment box and not intend it to
render as a new line, though?

~~~
ColinWright
Often. Why would you type endlessly long lines in a browser text area without
inserting the occasion new-line to aid readability in that text area?

I've seen people do this. I start to get anxious, wondering when they will
_ever_ hit the return key, wondering why they don't. I simply don't understand
why people do that.

Why don't you? You don't expect CR/LF in HTML to render in the browser, and
you format the HTML to read more easily, don't you?

~~~
krapp
Admittedly, because i'm lazy and don't think about formatting posts unless i'm
posting code, which is a bad habit. But still, every time I do hit enter in
this textbox, it should create a newline in the formatted post.

[edit - I added a newline between those two sentences, it's rendered as a
single line.]

~~~
ColinWright

      > ... every time I do hit enter in this
      > textbox, it should create a newline ...
                 ^^^^^^^^^
    

This is your expectation. It is not my expectation. I do not believe that
every time one hits enter in the text box it should create a newline in the
formatted post.

Why is your intuition more valid than mine?

~~~
krapp
I'm not going to claim it's more valid, but I do believe it more closely
follows the principle of least astonishment.

If I go through the trouble of posting three lines, but only one line appears,
then the result doesn't match what I intended to convey - it is as if I posted
an entirely run-on paragraph either way.

Granted, there are obvious paragraphs when you break two lines - but why that
and nothing at all for one?

~~~
ColinWright

      > ... I do believe it more closely
      > follows the principle of least
      > astonishment.
    

I would be more surprised to find that something I type in a textarea has its
line-feeds preserved as it gets converted from the text I type into HTML.

    
    
      > If I go through the trouble of posting
      > three lines, but only one line appears,
      > then the result doesn't match what I
      > intended to convey - it is as if I
      > posted an entirely run-on paragraph
      > either way.
    

Which is what happens when HTML is rendered to a screen. The line-feeds in the
HTML are not preserved.

We have different expectations. The existing behavior matches my expectations,
and it does not match yours. I have found you an explanation, but I expect you
will never agree with me about what's "natural" because we have different
beliefs about what "should" happen.

<fx: shrug />

It is what it is, and it won't change. You will disagree with the rationale
and "naturalness," but perhaps the fact that others exist with different
expectations may help you accept that it does not and will not do what you
thought was obviously "right."

I'm not, by the way, claiming that its behavior is more "right" than what you
expect. I'm merely pointing out that not everyone has the same expectations as
yours.

~~~
krapp
It does seem obvious to me, but i'm aware it's subjective. Between the two, I
suppose paragraphs are more explicit.

