Skip to content
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

Ignore added "line clear" characters in the Web Workflow serial #9934

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

Neradoc
Copy link

@Neradoc Neradoc commented Jan 4, 2025

Fix the printing of some control characters:

[2K[0GAuto-reload is on. Simply save files over USB to run them or enter REPL to disable.
[2K[0Gcode.py output:

to

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:

This just ignores the characters.
I don't think there is a need to implement erasing the line for the builtin web serial.

@@ -43,6 +43,8 @@ ws.onmessage = function(e) {
} else if (e.data == "\x1b[K") { // Clear line
log.textContent = log.textContent.slice(0, -left_count);
left_count = 0;
} else if (e.data == "\x1b[2K\x1b[0G") {
Copy link

Choose a reason for hiding this comment

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

It might be better to instead ignore every escape sequence.

This could be done really fast with ignoring everything from when we see "ESC[" to whenever we see an alphabet letter.
(65-90 or 97-122, the alphabet letter should be discarded too)

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you! We can follow up to ignore all if we want.

@tannewt tannewt merged commit af2c232 into adafruit:main Jan 6, 2025
234 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants