Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix serial monitor not auto-scrolling to bottom #1889

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

Closed
sfe-SparkFro wants to merge 1 commit into arduino:main from sfe-SparkFro:#1736
Closed

Fix serial monitor not auto-scrolling to bottom #1889

sfe-SparkFro wants to merge 1 commit into arduino:main from sfe-SparkFro:#1736

Conversation

@sfe-SparkFro
Copy link

@sfe-SparkFro sfe-SparkFro commented Feb 15, 2023

Motivation

The serial monitor auto-scroll doesn't go all the way down, as discussed in #1736

Change description

componentDidUpdate() has been added to the serial monitor code, which calls scrollToBottom(). This ensures the serial monitor goes to the bottom whenever new messages are received.

Other information

I have very little experience with React and TypeScript, so this may not be the best solution. But it works on my end, and no one else seemed to be working on this bug.

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)

Edivad99 and andreer reacted with hooray emoji
Copy link

CLAassistant commented Feb 15, 2023
edited
Loading

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Feb 16, 2023
@per1234 per1234 linked an issue Feb 17, 2023 that may be closed by this pull request
3 tasks
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sfe-SparkFro! I tested the PR build and verified it does fix #1736

Copy link

I tested the Windows_X86-64_zip and it works perfect over here.

Is there anything else I could do or need to do?

Thanks for your work

per1234 reacted with heart emoji

Copy link
Author

@per1234 Is this ready to be merged, or is something preventing that? Curious when this will make it to a release version, because I'm currently daily driving this PR, but now I'm getting pestered to update to 2.0.4 😛 Thanks!

Copy link
Contributor

kittaakos commented Mar 3, 2023
edited
Loading

With the proposed changes, scrollToBottom happens twice:

  • when the IDE2 frontend receives a message from the monitor:

https://github.com/sfe-SparkFro/arduino-ide/blob/391b4778351723e5b6fe57b1ecbaba224971ee5f/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx#L76

  • when the widget updates:

https://github.com/sfe-SparkFro/arduino-ide/blob/391b4778351723e5b6fe57b1ecbaba224971ee5f/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx#L59

I would prefer having one update that works correctly. Does my proposed change 👇 fix the issue on your side?

diff --git a/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx b/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx
index 13618020..12142f65 100644
--- a/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx
+++ b/arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-output.tsx
@@ -65,11 +65,13 @@ export class SerialMonitorOutput extends React.Component<
 this.state.charCount
 );
 const [lines, charCount] = truncateLines(newLines, totalCharCount);
- this.setState({
- lines,
- charCount,
- });
- this.scrollToBottom();
+ this.setState(
+ {
+ lines,
+ charCount,
+ },
+ () => this.scrollToBottom()
+ );
 }),
 this.props.clearConsoleEvent(() =>
 this.setState({ lines: [], charCount: 0 })
1736.mp4

I created a PR: #1928

Copy link
Contributor

per1234 commented Mar 7, 2023

Closing as superseded by #1928. Thanks again @sfe-SparkFro.

sfe-SparkFro reacted with thumbs up emoji

@per1234 per1234 added the conclusion: duplicate Has already been submitted label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@per1234 per1234 per1234 approved these changes

Labels

conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Serial Monitor scroll is incomplete when autoscroll is enabled

AltStyle によって変換されたページ (->オリジナル) /