Skip to content

[WIP] feat: Add a copy button to serial monitor #2718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

502E532E
Copy link

Motivation

When collecting data with the Arduino, a straight-forward way to retrieve it is to write it to the serial monitor (often in csv format or similar) and store it somewhere.

As addressed in various issues (#1081, #2093, #812), retrieving this data from the serial monitor is hard to impossible currently, as it does not really support copying, nor has the functionality to write the data to a file.

Change description

This pull request introduces a button that copies the content of the serial monitor to the clipboard. It uses the raw data stored in the frontend (an array of strings/lines) and joins it to a single string that is copied. This avoids the issue of formatted text completely (#2093) and makes it easy to copy the full content (#1081, #812).

Other information

In the long run (and in order to fully resolve the issues above), a proper copy mechanism of the current selection should be implemented. But this seems to be hard, some related issue (#105) is almost five years old and still open, although there was some implementation effort.

This pull requests aim is to provide some small quality of life feature. It might be replaced by some farther reaching change in the future, or might even stay as it is useful as a quick action nonetheless.

Feedback needed

I created this pull request because I want to use the feature myself. I do not really understand the code structure and style conventions of this repository (Is there some style guide document? I could not find it), so I need feedback on these aspects.

The code itself is working as I would want to use it, allowing to copy the content of the serial monitor to the clipboard. There is a test for the method that joins the lines, I am not sure if the GUI components require tests.

  • Is the functionality at the right location? The copying happens in serial-monitor-send-output, because it seems this is the only place where the lines are actually stored. It feels a bit wrong to do it there, though
  • Are more tests required?
  • Is there some documentation that needs updating?
  • Is the localization key reasonable? Does it need further action?

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

If the arduino collects some data that you want to store on your
computer, a rather simple way is to write it to the serial monitor and
copy it to the clipboard. This commit introduces a button that copies
the whole content of the serial monitor to the clipboard to make this
rather simple. It is a new component added to the menu, and does not
change the behaviour of other compontents.
Adds a test for merging one or more lines to a single string. It is
supposed to just concatenate the content of the lines, without doing
anything else. This method is used when copying the serial monitor content to
the clipboard.
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor labels Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants