Description
Describe the bug
It is sometimes useful to copy the text that was printed by an Arduino board to Serial Monitor. For example, I sometimes copy CSV-style data into a spreadsheet program when I want to do further manipulation and analysis.
🐛 This is currently not possible to do with any multi-line text because the copied content has missing (or perhaps non-standard) line endings.
To Reproduce
- Upload a sketch that prints multiple lines of text to serial:
void setup() { Serial.begin(9600); } void loop() { Serial.println("hello"); delay(1000); }
- Open the Serial Monitor view in the Arduino IDE (Tools > Serial Monitor).
- Select multiple lines of the text that was printed in the Serial Monitor view.
- Paste it into a text editor or spreadsheet program.
🐛 The line endings are not present:hellohellohello
Expected behavior
Text copied from Serial Monitor has standard line endings.
Arduino IDE version
2.0.0-rc3
Operating system
Windows, Linux
Operating system version
Windows 10, Ubuntu 20.04
Additional context
After copying the following Serial Monitor output:
a
a
a
This command reveals that there are no line endings:
$ xclip -selection clipboard -out | xxd -p
616161
I'm not sure why, but I do get line breaks when I paste the text to the Arduino Forum (Discourse) composer field. In that case, the problem is opposite because I get double spaced text.
But when pasting to VS Code, Notepad++, LibreOffice Calc, GitHub comment field, etc., even a fenced code block on the forum, I get no line breaks.
Related:
Originally reported at:
- https://forum.arduino.cc/t/serial-monitor/698844
- https://forum.arduino.cc/t/serial-monitor-text-copying-not-quite-right/938730
- https://forum.arduino.cc/t/each-day-a-new-problem/937997/3
- Garbage output in Serial Monitor when using ESP8266 via FTDI #427 (comment)
- https://forum.arduino.cc/t/text-selection-serial-monitor/1005262