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.

Way to view code blocks with loooong lines better

See original GitHub issue

Code blocks with long lines (as they appear in stack traces and similar) are shown with a scroll bar on Github:

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

That, combined with the 700px width of the comments makes it very hard to get an overview of the actual content.

image

It would be awesome if something like a “fullscreen” button would appear in the top right of the code block that e.g. takes the code block out of the comment box and lets it use the full screen width.

Bad mockup: image (Uses width:1800px; position:relative; left:-480px; to simulate the effect)

Maybe this could also be dynamic so it just uses the size it needs to the lines be fully displayed.

If the total screen width still is not enough, it would still show the scrollbar of course.

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
Mottiecommented, Sep 18, 2018

In GitHub Dark we use the following global css:

body:not(.nowrap) .blob-code-inner,
body:not(.nowrap) .markdown-body pre > code,
body:not(.nowrap) .markdown-body .highlight > pre {
  white-space: pre-wrap !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  display: block !important;
}
body:not(.nowrap) td.blob-code-inner {
  display: table-cell !important;
}

You can toggle a class of “nowrap” on the body to toggle the feature - this also works if you paste in the above css into the “Custom CSS” block of RGH.

There is also a GitHub toggle code wrap userscript that adds a button within each code block to allow toggling of the line wrap.

2reactions
sindresorhuscommented, Sep 6, 2018

Thanks for sharing the example. Makes sense.

I agree this could be useful. It should only be as wide as not needing a scrollbar anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Way to view code blocks with loooong lines better · Issue #1515
Code blocks with long lines (as they appear in stack traces and similar) are shown with a scroll bar on Github: Lorem ipsum...
Read more >
1 Code::Blocks Project Management
The display of line numbers in Code::Blocks can be activated via 'Settings' →'General Settings' in the field 'Show line numbers'. The shortcut Ctrl-G...
Read more >
Code blocks, but better - Pedro Duarte
In this post, I'll share with you how I built a custom code block component. ... Choose whether to display line numbers or...
Read more >
Long code blocks inside if statements or for loops
It's generally a good idea to be able to see the whole of a method on one screen. ... If the function contains...
Read more >
Reading from a File in Code Blocks - YouTube
More About File Input · C++ Tutorial 29 - Reading and Writing to Files - fstream · C++ file handling for beginners! The...
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