Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

A major gripe for me is when code samples in questions trigger a horizontal scrollbar.

These waste a lot of time when reading the code in question.

This is easily fixed with some conveniently placed newlines, but runs into the six non-blank character limit for edit.

Could the threshold be waived if an edit helps reducing line length of code samples?

Related question: Should SO warn people who post long line code samples?

share|improve this question
Is there nothing else in the post that could be edited? – JimmyPena Aug 2 '12 at 13:20
As @JimmyPena suggests, please evaluate the post in full. Don't just fix this annoyingly formatted bit of code, but address all the issues you see. If you do, then I think there is hardly a post where you will have less than 6 characters to fix. – Bart Aug 2 '12 at 13:57
You could always leave a comment to the OP asking for the code to be formatted to remove (or at least reduce) the horizontal scrolling. – Al E. Aug 2 '12 at 14:01
At 30 characters? – Arjan Aug 2 '12 at 16:43
@Arjan I don't think it's reasonable to start limiting display for the lowest common denominator. Whatever character width doesn't cause horizontal scrollbars on a normal browser (say, 800x600). On the desktop the space allocated to the code seems to be fixed no matter your screen size / browser window size (seems to be 93 characters if you haven't used custom styles or zoom). Folks on mobile devices will have to deal with the limitations of a web-based experience just like they do on every other site on earth. I don't know of a single site that optimizes their layout for 30 characters. – Aaron Bertrand Aug 2 '12 at 18:19
Oh, it's certainly not 93 for most people, if you look at that post; more likely 81. (And of course I was not serious about 30. Just saying it's hard to optimize.) – Arjan Aug 2 '12 at 18:24
As for your edit test: I doubt editing one's own post has any limitations? – Arjan Aug 2 '12 at 18:28
@Arjan I was able to edit as well. – Aaron Bertrand Aug 2 '12 at 18:37
Sure, with >2k, @Aaron, no tricks needed, right? Isn't the minimum character limit only for suggested edits? – Arjan Aug 2 '12 at 18:41
Ah I didn't realize the OP had low rep on SO as well, I only saw his rep here. Then I'm not quite sure, it may also be enough to pass as a suggested edit (the OP should try editing my answer). But still, I have to stress the point that the percentage of posts with horizontal scrollbars that also don't have any other problems at all is going to be quite small in my experience. – Aaron Bertrand Aug 2 '12 at 18:44
@Arjan: foolish me. I was able to edit Aaron's answer this way. – Henk Langeveld Aug 2 '12 at 19:19
up vote 11 down vote accepted

If the only thing wrong with the post is the line wrapping, then you could always add a comment too:

<!-- removed annoying horizontal scrollbars -->

I think this will bypass the limit, but haven't tested. I am certain, though, that I have successfully edited posts and only changed the wrapping and they succeeded. Maybe it's a rep thing?

But I suspect that even if this doesn't bypass the ban, most posts with careless code like this can be improved in other ways without extending too much effort.

I tend to agree that having to scroll horizontally wastes time and in most cases either makes me edit the post or, if it's hopeless, makes me move to the next question.

share|improve this answer
That will work, until it is abused, and Stack Exchange will be changed not to include HTML comments in the 6-character count. – kiamlaluno Aug 2 '12 at 13:29
@kiamlaluno true, I would prefer to make other edits to make it more substantial, than to fake it. I suspect the number of times this hack will be necessary is quite small. – Aaron Bertrand Aug 2 '12 at 14:13
I have come across some questions where the question is clear, the code looks decent, and really the only thing that it needs is a well placed line break. – Henk Langeveld Aug 2 '12 at 18:14
@HenkLangeveld but what percentage, would you guess? I agree that they exist, but most questions I see containing code with scrollbars also have other problems. – Aaron Bertrand Aug 2 '12 at 18:17
I tested it. I only added a comment, and it was accepted. – Henk Langeveld Aug 2 '12 at 18:20
And I was also able to add an html comment to this answer. Confirmed. – Henk Langeveld Aug 2 '12 at 19:20
@Aaron -- I would probably just use the old rule of thumb of 72 characters. It's a common style guide. From personal experience I know that I tend to prefer 60 column text windows for readability. Traditional copy-editing guidelines used to be in that ballpark. (Trivia: The Osbourne 1 was popular with magazine/newspaper editors because the screen limit of 60 characters matched their rules.) – Henk Langeveld Aug 3 '12 at 9:23

You must log in to answer this question.

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