Apologies if this has already been reported. A quick search did not find anything similar.
void setup() {
}
void loop() {
//This comment is so long that if you perform Auto Format on it, the last part of the comment will be wrapped onto the start of the next line and cause a compile error
}
Let me tell you a story. A noob asked me for help. Their sketch was almost completely un-indented and therefore difficult to read. What do we tell noobs to do in this situation? We tell them to Auto Format their code. And what do we do before telling a noob to do anything? We do it ourselves to make sure nothing wierd happens that they won't understand. Well, this time something wierd happened. The noob's long comment caused Auto Format to corrupt the sketch. Fortunately this happened to me rather than the noob. I figured out what happened. The noob might not have figured it out and given up on the whole Arduino thing prematurely.
Did you try to find out at which length the unintended line break happens?
Or does it break on a certain character?
any tests done with other IDE yet?
I can confirm the 0.22 version on win7/64 shows this bug too
What I see it inserts a '\n' on position 136 thereby not just breaking the comment, but also removing one char (e from next)
if I use a var with a long name it does not break at position 136 nor does it break long code lines @136
void loop() {
int thisvarislong_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 0;
int xxxxxxx = 0;
int y = xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + xxxxxxx + 1;
//This comment is so long that if you perform Auto Format on it, the last part of the comment will be wrapped onto the start of the n
xt line and cause a compile error
}
So it seems long comments are the only part affected
Stand down my friend, it appears to have been fixed in 1.0.5!
I thought the length it was breaking comments in was 132, but I may have miss-counted. That number rings a bell from the old days of green-screen terminals. And you are right, in my example above, the "e" from the word "next" is lost.
Thanks for your suggestion. All I need to do now is install 1.0.5 "properly".
Stand down my friend, it appears to have been fixed in 1.0.5!
I thought the length it was breaking comments in was 132, but I may have miss-counted. That number rings a bell from the old days of green-screen terminals. And you are right, in my example above, the "e" from the word "next" is lost.
Thanks for your suggestion. All I need to do now is install 1.0.5 "properly".
Paul
Most common ASCII CRT display terminals were limited to 80 character limits. The 132 character lines were for those large line printers.
“YOUTH” Samuel Ullman Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life. Youth means a temperamental predominance of courage over timidity of the appetite, for adventure over the love of ease. This often exists in a man of sixty more than a boy of twenty. Nobody grows old merely by a number of years. We grow old by deserting our ideals. Years may wrinkle the skin, but to give up enthusiasm wrinkles the soul. Worry, fear, self-distrust bows the heart and turns the spirit back to dust. Whether sixty or sixteen, there is in every human being’s heart the lure of wonder, the unfailing child-like appetite of what’s next, and the joy of the game of living. In the center of your heart and my heart there is a wireless station; so long as it receives messages of beauty, hope, cheer, courage and power from men and from the infinite, so long are you young. When the aerials are down, and your spirit is covered with snows of cynicism and the ice of pessimism, then you are grown old, even at twenty, but as long as your aerials are up, to catch the waves of optimism, there is hope you may die young at eighty.