1

If I have a block of code and try to insert it, and press the code button, it indents the 1st line. and that's it. It seems that alone is a bug by itself.

But the reason it comes up is that one has to reformat each line to turn it into a code line by going in and manually adding 4 spaces in front of each line. Now, sure, I can compose my code and then force it over by 4 spaces and copy and paste, but for a site focusing on code and programming, the opposite problem is also present. If someone wants to copy my code, they have to manually copy/paste and then manually edit it to git rid of the extra spaces to make it compile.

Another problem came up when I was inserting code lines interspersed by commentary. The parser got confused and wouldn't let me post a 1300 line update, claiming that somewhere in the text it thought it saw a code-bit and it didn't think it was formatted properly (despite the fact that the preview looked fine).

The parts that were code were indented and fixed width, but the commentary on each code segment wasn't supposed to be. It seems there needs to be a way to override the "It looks like you have some code that isn't formatted properly." when the fact that something "looks" like something isn't the same as it being something -- yet it called the appearance of misformatting, an error. I agree: the fact that it was confused was an error. But it's not a human being and a broken algorithm shouldn't prevent me from posting it if I know, from the preview, that it is being formatted exactly the way I intended it to be.

These seem rather basic -- I'm surprised others have not run into this before and that hasn't been fixed...

Both of these issues make this a bit hostile for discussing code (if such is even a priority). Can these be fixed?

3
  • If I may ask, what in the world would posses you to post 1300 lines of code/commentary to Programmers.SE? Such a question would be a bit excessive for the system and the people reading it. And while it's not at the 'code formatting is broken' question, such a post would be a bit difficult to digest and actually address the problem that you are asking about.
    – user40980
    Oct 4, 2014 at 0:56
  • What would possess you to think it was 1300 lines of code? It was a question, with commentary on multiple blocks of code that couldn't be returned to an existing question, causing a 1000+ line deletion.
    – Astara
    Oct 4, 2014 at 2:20
  • 1
    "The parser got confused and wouldn't let me post a 1300 line update, claiming that somewhere in the text it thought it saw a code-bit and it didn't think it was formatted properly (despite the fact that the preview looked fine)"
    – user40980
    Oct 4, 2014 at 3:24

1 Answer 1

2

When you have a block of code, you select the code, and then press the code button.

Paste your code:

raw code

Select your code:

selected code

Press the code button:

indented code

And its indented.

Admittedly, the text area here is a poor code editor. One is often better served by editing the code in another editor for code, and then copying and pasting the code into the spot and selecting the format on the code block.

Note that Programmers.SE isn't the best place to be discussing code, especially ones that would have the system wondering about 1300 line updates. If you have a question with such a substantial block of code, you should look at reducing the size into the specific parts that you are having design issues with.

1
  • That's why I mentioned it was separated by multiple pieces of commentary. The original program was 47 lines long. However, it had been revised over the course the the Q, there was earlier commentary which I didn't delete, adding new stuff to the beginning so that those who wanted to look at context could read down, as well as multiple examples of diagnostics elicited by various test cases. Something people are told to do -- show the work you've done getting to this point....then the auto censor can't handle intermixed comments and code blocks (separate paragraphs)...uh...I have the original
    – Astara
    Oct 4, 2014 at 2:25

You must log in to answer this question.

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