Go Down

Topic: SOLVED: Auto Format Bug (Read 6611 times) previous topic - next topic

PaulRB

May 10, 2014, 02:18 pm Last Edit: May 11, 2014, 11:35 am by PaulRB Reason: 1
Apologies if this has already been reported. A quick search did not find anything similar.

Code: [Select]

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
}


Arduino 1.0.1, Ubuntu 12.10, 64-bit

robtillaart

cannot reproduce on
- windows7/64
- IDE 1.5.4
- IDE 1.0.4

Have you tried a later IDE?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

PaulRB

I will attempt to upgrade to 1.0.5 and report back.

PaulS

Code: [Select]
//This comment is so long that
you look like an idiot. There is no excuse for comments that long. Program like a big boy, and hit the enter key occasionally.

PaulRB

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.

Do you understand now, PaulS?

robtillaart

@PaulRB
back to  analysis,
- 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
Code: [Select]
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


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

PaulRB

Hi Rob,

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

robtillaart

good to hear it is solved,

sigh, those good old green-screen vt100 terminals
wish I had saved a few when they were dumped by the dozen. Would be a nice partner for Arduino (a.o)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

retrolefty


Hi Rob,

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.


AWOL

Quote
That number rings a bell from the old days of green-screen terminals.

Sp. "That number rings a bell from the old days of 132 column line printers"
Green screen VDUs were usually 80 column, like punch cards.

PaulRB

Well, I deffo' remember using 132 columns on VT100 & VT220.

http://www.vt100.net/vt_history

But as 1.0.5 fixed the problem, its completely academic anyway.

retrolefty


Well, I deffo' remember using 132 columns on VT100 & VT220.

http://www.vt100.net/vt_history

But as 1.0.5 fixed the problem, its completely academic anyway.


Yea the link says:
Quote
A separate advanced video option was required to display 24 lines in 132-column mode; this was standard on the VT102 and VT131.


I wonder if one could actually read the characters in 132 mode without using a magnifier?   :smiley-roll:

robtillaart

One more or less recognized the overall shape / layout of the output first before really reading it.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

PaulRB


I wonder if one could actually read the characters in 132 mode without using a magnifier?   :smiley-roll:


I could... but I was young then... sniff...

robtillaart

Quote
I could... but I was young then... sniff...

you know this poem?

"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.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up