question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How should non-standard (not CR/LF) line-breaks be treated?

See original GitHub issue

For example, HTML newlines are LF, CRLF, CR,

The newline characters of CSS are LF, CRLF, CR and FF,

The newline characters of JS are LF, CRLF, CR, LS, PS.

Then the .html file as follows:

<style><FF></style><CR><script><LS></script>

It should be shown as (following the outermost mode):

<style></style>
<script></script>

Or (following the pattern of each layer itself):

<style>
</style>
<script>
</script>

?

At present, the mainstream editors do not care about the inner and outer layers at all. In fact, even if they are single language, they do not care about newline characters except LF, CRLF and CR. The difficulty of implementation is not considered here, but the rationality scale itself is only considered from the programming point of view.

Another edge case is that if there are fewer line breaks allowed in the inner layer than in the outer layer, then there are line breaks in the inner layer that are not converted in the inner layer but can be converted in the outer layer. How should the line number be displayed? Or is it that any language that can be nested avoids this when it is designed?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
joshgoebelcommented, Oct 13, 2019

Small issue with the wording, we aren’t an “editor”… I’ll update. I’ve given this a bit of thought just now… and my thought is only in the context of web usage. I have no thoughts outside that - and now one has brought this up as an issue (other than this hypothetical), and it would have to get a little less theoretical I think for me to have thoughts.

I’m currently just not sure any of these new ways to break a line matter at all. 😃

So, for web usage…

I would suggest that correct (and expected) behavior is that code block should be structured the same BEFORE and AFTER syntax highlighting other than color/italics/bold/etc. IE, highlighting a snippet should NOT alter the visible whitespace… I don’t expect whitespace/line breaks to be added, and I don’t expect it to be removed.

Note I specifically didn’t say “preserved”… I said visually not-altered.

So, regarding the web, is the existing behavior broken now according to this expectation?

1reaction
joshgoebelcommented, Oct 4, 2019

What are FF, LS, and PS non-abbreviated? I’m only familiar with CR/LF.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No line-break after a hyphen
The problem is that near the end of a line, because of the hyphen, it breaks and wraps to the next line instead...
Read more >
2.2.2. Line Divisions
The treatment of line divisions is one of the most difficult issues in designing ... Frequently line divisions have no representation as a...
Read more >
Forum - Remove carriage return from CrLf
I suspect they would treat the NULL as the end of the string, causing it to not see the line feed maybe. Don't...
Read more >
RFC 2046: Multipurpose Internet Mail Extensions (MIME) ...
It should not be necessary to add any line breaks to display "text/plain " ... The treatment of CRLF sequences becomes extremely problematic...
Read more >
5 The Content-Transfer-Encoding Header Field
"8bit" means that the lines are short, but there may be non-ASCII ... would affect the treatment of CRLFs, given that the representation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found