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

My questions/answers have code blocks and lengthy ones, I would like to have horizontal scroll bars instead of wraping the text. What kind of format I should do to achive this. Please help me.

share|improve this question
    
I've clicked through many of your answers and questions, and could not find a single one which does imply that you do not know how code formatting works. So, what's the question here? –  Time Traveling Bobby Feb 10 '12 at 9:38
    
Just go thro my answeer here stackoverflow.com/questions/9223583/…. Here I would like to have single line for code blocks with horizontal scroll bar. The code block <input type='hidden' value='<%=dynamicallyCreatedURL%>' id='dynamicallyCreatedURL'/> wrapped, Instead I would like to have in single line with scroll bar. Is it Possible? –  Selvakumar P Feb 10 '12 at 9:49
1  
@Bobby - you're too fast for me... –  Lix Feb 10 '12 at 9:52
    
What gave you the impression that the four-space-indentation does not work for single lines? –  Time Traveling Bobby Feb 10 '12 at 9:53
    
@Bobby - That was weird though - I read the question. But by the time I clicked edit I was already editing YOUR revision... –  Lix Feb 10 '12 at 9:58
    
@Lix: Yeah, welcome in the fantastic world of automatic brain- and thought-reading edits. It's a feature Jeff wrote tonight, the moment Stack Overflow scans your brain with it's mind and applies the changes you want to make. –  Time Traveling Bobby Feb 10 '12 at 10:01
1  
@Bobby - What a genius idea! You should take a look at the foot massage user-script too! –  Lix Feb 10 '12 at 10:04
    
Be warned that there are people who will deliberately edit your code back to a readable (i.e. without scrolling) form... –  Benjol Feb 10 '12 at 13:32

2 Answers 2

up vote 5 down vote accepted

if you mean code blocks - as displayed with lines starting at four or more spaces - like this:

System.out.println("1. My questions/answers have code blocks and lengthy ones, I would like to have horizontal scroll bars instead of wraping the text. What kind of format I should do to achive this. Please help me. 2. My questions/answers have code blocks and lengthy ones, I would like to have horizontal scroll bars instead of wraping the text. What kind of format I should do to achive this. Please help me. 3. My questions/answers have code blocks and lengthy ones, I would like to have horizontal scroll bars instead of wraping the text. What kind of format I should do to achive this. Please help me. 4. Have to admit, I am not very good at formatting my code. 5. some people say that long lines make it harder to analyse side-by-side diffs at code review but I don't care." 

...then I would recommend to learn how to improve formatting of your code.

share|improve this answer
    
Wow... I never thought of the reviewing nightmares this creates... Yuck –  Lix Feb 10 '12 at 9:42
1  
@Lix: If you think that's bad, have a look at the abuse in the sandbox. ;) –  Time Traveling Bobby Feb 10 '12 at 9:55
1  
Yes - That's a madhouse :P –  Lix Feb 10 '12 at 10:02
    
@Lix: And you only see the 'lite' version, wait until you reach 10k. ;P –  Time Traveling Bobby Feb 10 '12 at 10:04
1  
@Bobby - 10k on meta??? I've been here for 60days overall! Does my name tag say "Lix's Reputation Bordello"??? –  Lix Feb 10 '12 at 10:07
    
@Lix: No...but maybe you'd receive more upvotes with that name. ;P –  Time Traveling Bobby Feb 10 '12 at 10:11
2  
@Bobby - I was thinking more on the lines of Jeff9 Waffle The Lizzard Balpha's Reputation Gravell and John Skeet souvenirs emporium –  Lix Feb 10 '12 at 10:17
    
@Lix: Awesome! :D –  Time Traveling Bobby Feb 10 '12 at 10:21
    
@Lix, I like that second one –  Benjol Feb 10 '12 at 13:31

If you are posting huge blocks of code - perhaps you are posting too much code. One should only include the portions of the code that he/she feels are relevant to the problem.
One thing to note is that you can use the four spaces in front of the line to disable the text wrapping feature :

( alert! )

That way you can write really long sentences and/or lines of code while still staying on the same line! <br/> No linebreaks here! <br/> You will never know if there is anything important at the end of the line but you just have to keep scrolling!! This is extremely annoying (as you probably have notices by now ;) So leave the text wrapping alone cause it will keep us all sane.

Check out the FAQ for Stack Exchange sites. Specifically the Formatting Sandbox section - I think you'll be able to find ALL the examples of what is possible there :P

In case it was not clear - it's a little bit annoying to have to scroll through text/code like that. Unless it is explicitly required ( love to get some examples if there are some ), then single long lines of text or code should be used sparingly.

share|improve this answer

You must log in to answer this question.

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