3 ms·
Ask HN: Why do I need a double return when typing a comment?
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?
FF29 on Win7 btw.
- ColinWright 12y agoI 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 12y agoWhen would you ever add a new line in the comment box and not intend it to render as a new line, though?
- thisjepisje 12y agoIndeed, if it's not readable when you're typing it, it's probably not readable when you've posted it.
- ColinWright 12y agoOften. 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 12y agoAdmittedly, 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 12y ago> ... 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 12y agoI'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?