What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

Is there any way to make the code-blocks wider? I find it very annoying to scroll horizontally which happens quite often.

Maybe a possibility to expand the codeblocks?

share|improve this question
    
Could i please get a comment on the downvote? –  Daniel Figueroa May 12 '12 at 15:27
5  
Downvotes on meta mean "I don't agree with what you say". So someone thinks "no, we don't need that". –  Felix May 12 '12 at 15:32
2  
With properly formatted code this should not really be a problem... If you need to write a really really really long line of code, chances are anywhere it were to be displayed a scroll bar would be present. –  Lix May 12 '12 at 15:33
1  
Ahh. Okay I thought that maybe my question was malformed in some way. –  Daniel Figueroa May 12 '12 at 15:35
1  
@Lix please take a look at the code-examples in SE almost everyone of them requires horizontal scroll. What I'm proposing is not a redesign of the site in total, but maybe the alternative to perhaps expand the code-blocks for greater readability. –  Daniel Figueroa May 12 '12 at 15:41
2  
@Lix: 81 characters is hardly "really really really long" these days. Most of use aren't using VT320s any more... Out of interest, go to an IDE window which you happen to look at in the real world - how wide is that, in characters? I'd be surprised if it were only 80 characters. –  Jon Skeet May 12 '12 at 16:38
    
There are a lot of ways StackOverFlow could handle code such that someone whose browser spans more than 1024px wouldn't have to scroll within a text box. An author's code could be forcibly truncated to 81 columns, forcing them to reformat; a tidy-like library could reformat it for them; or SOF could simply increase the width of the text area to, say, 120 as per Jon Skeet's preference. But the solution of scrollbars is not a good one. –  chb Jun 16 '12 at 16:02
    
True, @Jon, though I often still use 80 (or 100; just a small random number that I know will fit in all views) for Javadoc comments. –  Arjan Jun 17 '12 at 16:19

2 Answers 2

up vote 1 down vote accepted

People posting really long lines of code - too long to be viewed on a single line, might be an indication that they are posting too much code. This, however, is not a catch-all rule and I'm sure that in some cases it's justified.

In my (short) time on SO I've never felt that every post requires me to use the horizontal scroll bar to view longer lines of code... Admittedly, around 80 characters is not that much but if you do come across an example of someone posting too much code you should comment and ask them to only include the parts that they feel relevant to the problem. If they are unable to do that then perhaps they have not spent enough time researching their issue.


If you want a "work around" to expand the view of the code to as wide as your screen/browser window goes, you can simply go into the revisions of the post -

http://meta.stackexchange.com/questions/**POST_ID**/...
                      ↓
http://stackoverflow.com/posts/**POST_ID**/revisions

Then view the source -

enter image description here




Here is an example of a post with a horizontal scroll bar -

enter image description here

But viewing the source of that post gives you this -

enter image description here

share|improve this answer
    
I absolutely agree with you on the writing to much code-part. I will not stop wanting for this feature though :) Also after a more thorough lookthrough I confess that not that many as I might have indicated(thought at first) require horizontall scrolling. –  Daniel Figueroa May 12 '12 at 15:58
    
Hmm... didn't notice it before, but this actually doesn't really help - it removes the scroll bar but now the text is wrapped in a <pre> element taking every line break literally as opposed to being rendered in markdown as it is on the site. –  Lix May 12 '12 at 16:16
1  
I disagree with this strenuously. I frequently have to reformat code which would be fine in normal usage, but which is too wide for SO's narrow central column. This is absolutely not an indication of posting too much code - it could be a single line which happens to be wider than the amount SO can display. On the other hand, it's easy to end up with hundreds of lines (genuinely too much code) which are all short. –  Jon Skeet May 12 '12 at 16:35

Firstly, I think the "every" part of your question is somewhat odd - it's not like that many questions (or answers) require scrolling... but I find that a lot of answers require very careful formatting, often into more lines than would usually be required, in order to avoid scrolling. (I very rarely post an answer which has horizontal scrollbars, simply because it makes it so hard to read.)

This is really a function of the width of the main section of SO's window - which in my view is too narrow to start with. Code is just one area that this impacts.

The plus side of using a fixed, narrow width is that everyone sees (roughly) the same thing. We don't end up in the nasty situation where the code looks fine on my machine, but scrolls on yours.

The downside is that on my "home laptop" screen - and I'm sure many other readers - most of the screen is wasted.

On my netbook, most of the screen is used, so there's not a huge amount of room for expansion - but I suspect there are ways round that. For example, with a wider "main" column, the right hand side-bar could detect if there wasn't space for it, and turn into a sort of "expandable" section. (Sorry for not knowing the appropriate UI terminology here.)

Once more width was available in general, we'd have room for more code. Personally I find the difference in restrictiveness between 80 columns and 120 is massive - it's pretty common for me to have to wrap things in SO where I wouldn't normally do so in an IDE, but I would wrap at about 120 columns normally, to avoid a line getting too long to comfortably understand. There are plenty of cases where what you're trying to express is fine to include in one line, but 80 columns just aren't enough.

share|improve this answer
1  
The every part is a misstake, will edit it. –  Daniel Figueroa May 12 '12 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .