Comment/Uncomment bug

On Arduino 0017 on Mac, try the following:

  1. Type this code:
void loop() {
  delay(1000);
}
  1. Select the second line.
  2. Click Edit > Comment/Uncomment
  3. Click Tools > Autoformat
  4. Goto 2.

Notice anything?

void loop() {
//  //  //  //  //  //  //  //  delay(1000);
}

That is probably THE most annoying bug I've found in the IDE, so I wanted to let you know it exists! :)

I agree, that's kinda annoying. I don't use Auto Format very often, because I write my code formatted most of the time, but if only used once, the uncomment won't work anymore.

Also, I'd like to add, that when using the mentioned steps a blank line is added to the file at the end.

what happens in 0018?

It is out as 'final' version now

Mowcius

mowcius, I've tested it in the 0018 'final' version as well as in the latest subversion version from trunk.

The problem's also in those.

Hmm, submit it for 0019 then and stop using autoformat! Stop being lazy! ;D

Mowcius

I believe this happens because of a desire to allow the commenting of large blocks of code that contain explanatory comments.

For example, this: // create a variable x int x = 0; x = x + 1;

should become: // // create a variable x // int x = 0; // x = x + 1;

Still, if all the lines are already commented (even if preceded by initial whitespace), it would probably make sense to uncomment them rather than adding an extra level of commenting.

I created an issue for this here: http://code.google.com/p/arduino/issues/detail?id=197