Open per1234 opened 2 years ago
This is a problem in the console text area of the IDE becuase running arduino-cli
from the command line shows the expected progress bar: this means that the standard-out stream from avrdude
is correctly sent through gRPC.
We had this problem before in the Arduino IDE 1.8.x, it basically boils down to the text area not correctly handling the CR
(Carriage Return) character:
CR and LF are control characters or bytecode that can be used to mark a line break in a text file.
CR = Carriage Return (
\r
,0x0D
in hexadecimal,13
in decimal) — moves the cursor to the beginning of the line without advancing to the next line. LF = Line Feed (\n
,0x0A
in hexadecimal,10
in decimal) — moves the cursor down to the next line without returning to the beginning of the line.
To render the progress bar, avrdude
repeatedly overwrites the same line using CR
as a control character to move the cursor back at the beginning of the line, without advancing to the next one. The issue here is that the IDE text area interprets CR
as CR+LF
moving the cursor to the next line.
IMHO this issue should be moved to the Arduino IDE repo.
Another question is: isn't the "console" text area already supporting some terminal control standard?
If we must implement all control characters from an ANSI terminal it will become a project on its own... maybe there is already an implementation of a "terminal" or a "console" text area that support ANSI (or vt100 or any other terminal standard) that can be reused.
Thank @cmaglie. I didn't interpret the gRPC response content correctly. You are correct that Arduino CLI is handling it correctly and this is a bug in Arduino IDE. I have updated the issue and transferred it to the correct repo.
The Output view is an editor and not a terminal. If we want terminal behavior, we must use a Pseudoterminal
from VS Code. This change requires a bigger effort on the IDE2 side.
Describe the problem
Some command line tools generate an animated progress bar by using a carriage return without newline to repeatedly overwrite the same line.
🐛 This does not work when their output is printed in the "Output" view. The carriage return causes a line break to be added.
To reproduce
Expected behavior
The current line is overwritten from the start of the line in the "Output" view with subsequent text.
For example, this text:
Should result in this content in the output view:
Arduino IDE version
2.0.0-snapshot-4e590ab
Operating system
Windows, Ubuntu
Operating system version
Windows 10, Ubuntu 20.04
Additional context
Support was added in Arduino IDE 1.x by https://github.com/arduino/Arduino/pull/9954
Originally reported at https://forum.arduino.cc/t/arduino-2-0-0-mac-ugh-why-so-backwards/1033549
Issue checklist