I know that it isn't a new question (I read already some others questions) but:

  1. the question was asked many months ago;
  2. my problem, perhaps, is a little different!

Well, as I wrote in the previous message I'm blind and when I try to insert a question I have many problems with correctly indenting my code! I try the shortcut ctrl+K but it add the first 4 spaces and nothing else! If I try to indent this code, for example:

String buf;
buf="buf isn't null";
buf="buf is null";

If I selected all rows and press ctrl+K all rows are shifted to right by 4 spaces and the check returns an error because the rows 3 and 5 aren't indentent correctly and now there is the problem... if I select lines 3 and 5 and press ctrl+K again, the editor deletes the 4 spaces!

My question is: why don't you implement an HTML tag (something like <bad code>) that skips the control and, the negative thing, add a "bad reputation" to the author? I don't ask a workaround, but I can't lose 3 hours (yesterday I lost this time) for a question that already I can't post because the code is blocked! Another suggestion: could we be to able ask a moderator to add that bad reputation if he/she see the author never indent his/her code or remove the "bad reputation" if he/she see the author try to indent the code but it isn't indent perfectly! What do you think about it?

P.S.: This post is caused by the frustration that I have because from yesterday to today I can't insert a question on stack overflow because my code isn't indented correctly... If you should see how many times I try to fix it tou could understand my frustration!

P.S.2: can you implement the tag title on your toolbar icon? It could help me to use it.

@Hammar: ok, I write here what I think should be the correct code: String buf; if(buf!=null) buf="buf is not null"; else buf="buf is null"; ...

There are some errors to this code?

Ok, now I understand that the error wasn't where I thought (or better it COULD be in another place) so my new suggestion is: why don't you create a function that insert a tag for delimited where is the error? I not that you already change the post (for example deleting the initial phrase: "Hello all,") but i don't know how you do the check so I don't know if it is possible!

Ok, now I inset the question that caused this post and my frustration, the question is this:


and I resolve the check adding 4 space around all "suspected" code and adding some empty line... Tell me if it is better change the title for only the last suggestion or is better keep all things for, in the future, understand why and what I asked...

  • Are you asking to automatically fix the indentation/formatting of the code which gets indented? If yes, I'll -1 you, because that's not good. – Time Traveling Bobby Dec 1 '11 at 11:41
  • 1
    I very much doubt that your problem had anything to do with lines 3 and 5 not being indented according to best practices, as long as the entire code block was indented four spaces. AFAIK, SO doesn't attempt to parse your code in any such way. The more likely explanation is that the problem was with some other part of your question. – hammar Dec 1 '11 at 12:10
  • @ bobby: no i'm not asking an automatic indentation fuction... I'm asking a little more flexible check... As I said I try something like 20 times to insert a question that is all times blocked for some error in indentation and, you must trust me, I DON'T CLICK 20 TIMES TO POST QUESTION WITHOUT CHANGING THE CODE! – Filippo1980 Dec 1 '11 at 13:06
  • @ Hammar: well, from my experience the indentation works like this example: first row: 4 space; if the second row contains a method like "if","for", "try", "while" the second row will have only 4 space; from the third row to the end of method insert in the second row the code will have 8 space and soon on so in my example I should: <br> String buf;<br> if(buf!=null)<br> buf="buf is not null";<br> else<br> buf="buf is null";<br><br>there are some errors in my indentation? – Filippo1980 Dec 1 '11 at 13:14
  • emh sorry for the last comment... i would write: String buf; if(buf!=null) buf="buf is not null"; else buf="buf is null"; ... – Filippo1980 Dec 1 '11 at 13:17
  • @hammar The OP's trying to reach you but is having difficulty (a space was added after the @ sign) – The Unhandled Exception Dec 1 '11 at 13:19
  • @TheUnhandledException: Awesome! What a service! *thumbs.up* – Time Traveling Bobby Dec 1 '11 at 13:20
  • Filippo1980, edit your question and put the code in there... it's hard to tell what you mean when it's in a comment. Also, your responses to bobby and hammar won't reach them if there's a space after the at sign... I don't know if you can resolve that or not. – The Unhandled Exception Dec 1 '11 at 13:20
  • In that case, nevermind. – Time Traveling Bobby Dec 1 '11 at 13:20
  • lmao @Bobby... don't shoot the messenger... I'm just trying to help :-) – The Unhandled Exception Dec 1 '11 at 13:22
  • @TheUnhandledException: There was no irony in my statement. :) – Time Traveling Bobby Dec 1 '11 at 13:42
  • 1
    @Filippo1980: You might need a blank line between the normal text and your code. – hammar Dec 1 '11 at 13:44
  • @ Hammar: ok, perhaps the problem was over there... now the question is save correctly... I re edit this question for adding also this information :) – Filippo1980 Dec 1 '11 at 14:35

You said in your question:

This post is caused by the frustration that I have because from yesterday to today I can't insert a question on stack overflow because my code isn't indented correctly

I don't think this is actually the case. StackOverflow will not prevent you from posting a question if your code is not indented properly. It will only prevent you from asking a question if your code is not formatted like code.

I think we need more specifics on what the actual problem you're facing is.

Are you getting an error message? If so, what is it?

Are you sure all code has been formatted as code? (Using ctrl+K)

Are you referencing code inline within English sentences? If so, escape that code in backticks (like this).

And a final thought: have you tried editing your questions in an external editor and then pasting them into StackOverflow? I know a lot of people do this just because they find it easier / better... but I cannot imagine how it would be to use this site if one was blind. I would think that using the internet (which is very visual) would be difficult in and of itself, and programming alone would be a major challenge. Trying to indent text properly when you can't see the indentation could easily be a nightmare. You have my respect and empathy!

What do you edit code in when programming? Could you use that to edit StackOverflow questions? If you can indent your code in there more easily (that is, if it's more accessible) that might help?

  • This is the error that the page returns:@ The Unhandled Exception: Oops! Your question couldn't be submitted because: •Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon. – Filippo1980 Dec 1 '11 at 13:34
  • 1
    Yes, @Filippo1980, that means you have other code that's not indented 4 spaces. It does NOT mean the indentation within the code is not correct. Do you talk about code within sentences? If so, try placing backticks around that, like: I tried calling someFunction(myParam1, myParam2) but that didn't work – The Unhandled Exception Dec 1 '11 at 13:37
  • @ The Unhandled Exception: I read some pages and now I'm try to insert the code betwenn the tags <pre><code> and simply click ctrl+k after the selection of the code's block! – Filippo1980 Dec 1 '11 at 13:38
  • @ The Unhandled Exception: ok, the problem was that I understund another thing :) now my question is: can change the code inserting something like [the error is here]code not formatted[/error]? Now I will change my question to add this question :) – Filippo1980 Dec 1 '11 at 13:48
  • Sorry Filippo1980 I somehow missed that you had two other comments. I just cleaned up your question, even though it's 3 months later... if there's any issues you have using the site please ask a new question here on meta. Sorry I failed to respond to your comments! – The Unhandled Exception Feb 24 '12 at 13:07

You must log in to answer this question.

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