I understand, from reading other Meta questions on this topic, that the StackOverflow administrators have good reasons for keeping the site to a fixed-width layout. However, one disadvantage of this layout that regularly frustrates me is the poor readability it imposes on code snippets. Horizontal scroll bars are a terrible thing, especially when trying to read code, when I often need to see both ends of the text at once (as opposed to letting my view flow from the end of one line to the beginning of the next). And unless the author of a StackOverflow post has been very careful to cut their code down to 80 characters per line, code blocks nearly always have horizontal scroll bars because the fixed width of the post column is so narrow.
The horizontal scroll bars are even more frustrating when I consider that I have a nice big 1920x1080 monitor that can easily display 256-character lines in my IDE, and yet I'm forced to view the code in a tiny window with scroll bars, surrounded by empty space.
Sure, I know that 80 characters is a standard width for formatting code, and StackOverflow is trying to discourage posting huge chunks of code, but some code snippets simply can't conform to that width even when reasonably-sized. In particular, code in Java, C#, and Objective-C tends to force the scroll bars to appear simply because standard type names, identifiers, and function signatures are very verbose.
Since most people these days have a wider monitor than the 1024-pixel width the StackOverflow layout was designed for, can the site somehow enable code snippets to use more of this width when the user desires it? Possibilities include:
- Code blocks can "pop out" into a separate, resizeable browser window
- Code blocks can temporarily (either with a toggle button or on-hover) expand dynamically to fill the width of the screen, pushing sidebar content out of the way if necessary
- The user can reduce the font size of text in code blocks relative to other text on the site (this would allow more characters to fit in the same fixed-width column, and the user could then zoom-in the page to maintain the same effective text size).
- The site has both the standard fixed width layout and a "wide" fixed width layout, where the "wide" layout is designed for at least 1440-pixel screen widths (yes, this is a much more heavy-weight solution).
I do not think this is a duplicate of View code in new window because that question is a request for one particular solution to this problem. I'm making a more general request for any solution to the problem, even if it isn't specifically "viewing code snippets in a new window."