Skip to content

Add support for pasting multi-line strings in Serial Monitor #2164

Open
@M65649

Description

@M65649

Describe the problem

When pasting in a multi-line string in the serial monitor, line-feeds or carriage returns will be removed and replaced with space.

To reproduce

I used the following sketch to test:

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    Serial.print((char)Serial.read());
  }
}

Pasting in the following:

1
2
3

Produces:

1 2 3 in the serial monitor. Can also verify via printing the hex values of the characters that the new lines are not included and replaced with space: 0x31 0x20 0x32 0x20 0x33. When printing the hex values and using e.g. PuTTY, one can see that the input correctly includes carriage returns.

Expected behavior

Expected behavior would be:

1
2
3

Arduino IDE version

2.1.2-nightly-20230807

Operating system

Windows

Operating system version

Window 10 22H2

Additional context

This feature is also not available when using the Arduino IDE 1.x Serial Monitor.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions